Skip to content
wiki.fftac.org

Functions - Source Excerpt 01

Back to Functions

Summary

This source excerpt preserves a bounded section of Anti-Christ.net/wp-content/themes/anti-christ-thin-veil/functions.php so readers can inspect the evidence without opening the full source file.

**Source path:** Anti-Christ.net/wp-content/themes/anti-christ-thin-veil/functions.php

<?php
/**
 * Theme functions for Anti-Christ Thin Veil.
 *
 * @package Anti_Christ_Thin_Veil
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

define( 'ACTV_VERSION', '3.28.0' );

require_once get_template_directory() . '/inc/member-system.php';
require_once get_template_directory() . '/inc/editorial-content.php';

if ( ! function_exists( 'actv_setup' ) ) {
	/**
	 * Register theme supports, menus, and editor styles.
	 */
	function actv_setup() {
		load_theme_textdomain( 'anti-christ-thin-veil', get_template_directory() . '/languages' );

		add_theme_support( 'automatic-feed-links' );
		add_theme_support( 'title-tag' );
		add_theme_support( 'post-thumbnails' );
		add_theme_support( 'responsive-embeds' );
		add_theme_support( 'align-wide' );
		add_theme_support( 'editor-styles' );
		add_editor_style( 'assets/css/editor.css' );

		add_theme_support(
			'html5',
			array(
				'search-form',
				'comment-form',
				'comment-list',
				'gallery',
				'caption',
				'style',
				'script',
			)
		);

		add_theme_support(
			'custom-logo',
			array(
				'height'      => 96,
				'width'       => 96,
				'flex-height' => true,
				'flex-width'  => true,
			)
		);

		register_nav_menus(
			array(
				'primary' => esc_html__( 'Primary Veil Navigation', 'anti-christ-thin-veil' ),
				'footer'  => esc_html__( 'Footer Civic Links', 'anti-christ-thin-veil' ),
			)
		);
	}
}
add_action( 'after_setup_theme', 'actv_setup' );

/**
 * Enqueue local-only assets. No external fonts, trackers, or CDNs.
 */
function actv_enqueue_assets() {
	wp_enqueue_style( 'actv-style', get_stylesheet_uri(), array(), ACTV_VERSION );
	wp_enqueue_script( 'actv-theme', get_template_directory_uri() . '/assets/js/theme.js', array(), ACTV_VERSION, true );
}
add_action( 'wp_enqueue_scripts', 'actv_enqueue_assets' );

/**
 * Register an optional footer sidebar.
 */
function actv_widgets_init() {
	register_sidebar(
		array(
			'name'          => esc_html__( 'Footer Dispatch', 'anti-christ-thin-veil' ),
			'id'            => 'footer-dispatch',
			'description'   => esc_html__( 'Optional civic notes, resource links, or site disclaimers.', 'anti-christ-thin-veil' ),
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<h2 class="widget-title">',
			'after_title'   => '</h2>',
		)
	);
}
add_action( 'widgets_init', 'actv_widgets_init' );

/**
 * Fallback menu used before the starter pages are created.
 */
function actv_primary_menu_fallback() {
	$links = array(
		'start-here'          => esc_html__( 'Start Here', 'anti-christ-thin-veil' ),
		'journal'             => esc_html__( 'Journal', 'anti-christ-thin-veil' ),
		'religion-and-the-machine' => esc_html__( 'Religion & The Machine', 'anti-christ-thin-veil' ),
		'the-machine'         => esc_html__( 'The Machine', 'anti-christ-thin-veil' ),
		'civil-liberties'     => esc_html__( 'Civil Liberties', 'anti-christ-thin-veil' ),
		'socioeconomic-decay' => esc_html__( 'Socioeconomic Decay', 'anti-christ-thin-veil' ),
		'field-guide'         => esc_html__( 'Field Guide', 'anti-christ-thin-veil' ),
		'submit-dispatch'     => esc_html__( 'Submit', 'anti-christ-thin-veil' ),
		'members'             => esc_html__( 'Members', 'anti-christ-thin-veil' ),
	);
	?>
	<ul class="primary-menu fallback-menu">
		<?php foreach ( $links as $slug => $label ) : ?>
			<li><a href="<?php echo esc_url( actv_page_url( $slug ) ); ?>"><?php echo esc_html( $label ); ?></a></li>
		<?php endforeach; ?>
	</ul>
	<?php
}

/**
 * Return an SEO description for the current public view.
 *
 * @return string
 */
function actv_meta_description() {
	$default = __( 'Anti-Christ.net is a disciplined, pluralist, privacy-first gothic civic archive studying false-salvation systems, lawful dissent, civil liberties, religious co-optation, surveillance, debt, courts, and bureaucracy.', 'anti-christ-thin-veil' );

	if ( is_front_page() ) {
		return __( 'Anti-Christ.net is a gothic civic archive for lawful dissent, civil liberties, religious co-optation, socioeconomic pressure, surveillance culture, and claim-disciplined public memory.', 'anti-christ-thin-veil' );
	}

	if ( is_home() ) {
		return __( 'Journal dispatches from Anti-Christ.net: source-led essays, civic critique, claim reviews, lawful toolkit notes, and dispatches from the thin veil.', 'anti-christ-thin-veil' );
	}

	if ( is_category() ) {
		$term = get_queried_object();
		if ( $term instanceof WP_Term && ! empty( $term->description ) ) {
			return wp_strip_all_tags( $term->description );
		}

		if ( $term instanceof WP_Term ) {
			return sprintf(
				/* translators: %s is a category name. */
				__( 'Anti-Christ.net archive lane for %s: source-led essays, civic critique, cultural analysis, and lawful documentation.', 'anti-christ-thin-veil' ),
				$term->name
			);
		}
	}

	if ( is_singular( 'post' ) ) {
		$excerpt = has_excerpt() ? get_the_excerpt() : wp_strip_all_tags( get_post_field( 'post_content', get_the_ID() ) );
		if ( $excerpt ) {
			return $excerpt;
		}
	}