Theme Setup
**Site relevance:** 2IA.org
**Memory type:** theme source memory
**Source path:** 2IA.org/wp-content/themes/twoia-intelligence/inc/theme-setup.php
**Size:** 3.4 KB
Summary
Theme setup and support declarations.
Source Preview
This source file is short enough to preview directly on its source-memory page.
<?php
/**
* Theme setup and support declarations.
*
* @package TwoIA
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Set up theme defaults and WordPress feature support.
*/
function twoia_theme_setup() {
load_theme_textdomain( 'two-identities-anonymous', 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( 'wp-block-styles' );
add_theme_support( 'customize-selective-refresh-widgets' );
add_theme_support(
'html5',
array(
'comment-form',
'comment-list',
'gallery',
'caption',
'script',
'style',
'navigation-widgets',
'search-form',
)
);
add_theme_support(
'custom-logo',
array(
'height' => 96,
'width' => 96,
'flex-height' => true,
'flex-width' => true,
)
);
add_theme_support( 'editor-styles' );
add_editor_style( 'assets/css/theme.css' );
register_nav_menus(
array(
'primary' => esc_html__( 'Primary Menu', 'two-identities-anonymous' ),
'footer' => esc_html__( 'Footer Menu', 'two-identities-anonymous' ),
'research' => esc_html__( 'Research Menu', 'two-identities-anonymous' ),
)
);
add_image_size( 'briefing-card', 720, 480, true );
add_image_size( 'briefing-hero', 1440, 760, true );
}
add_action( 'after_setup_theme', 'twoia_theme_setup' );
/**
* Register widget areas for optional, privacy-respecting extensions.
*/
function twoia_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Research Sidebar', 'two-identities-anonymous' ),
'id' => 'research-sidebar',
'description' => esc_html__( 'Optional sidebar for research pages and archives.', 'two-identities-anonymous' ),
'before_widget' => '<section id="%1$s" class="widget briefing-panel %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer Briefing Column', 'two-identities-anonymous' ),
'id' => 'footer-briefing',
'description' => esc_html__( 'Optional footer content area.', 'two-identities-anonymous' ),
'before_widget' => '<section id="%1$s" class="widget footer-widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="footer-heading">',
'after_title' => '</h2>',
)
);
}
add_action( 'widgets_init', 'twoia_widgets_init' );
/**
* Keep comments closed by default unless the site owner explicitly enables them.
* This does not delete comments or remove WordPress comment features.
*
* @param bool $open Whether comments are open.
* @param int $post_id Current post ID.
* @return bool
*/
function twoia_comments_open_by_default( $open, $post_id ) {
if ( is_admin() ) {
return $open;
}
if ( get_theme_mod( 'twoia_enable_comments', false ) ) {
return $open;
}
return false;
}
add_filter( 'comments_open', 'twoia_comments_open_by_default', 10, 2 );
/**
* Hide comment feeds when comments are disabled by the theme default.
*
* @param bool $show Whether to show comment feed link.
* @return bool
*/
function twoia_hide_comment_feed_link( $show ) {
if ( get_theme_mod( 'twoia_enable_comments', false ) ) {
return $show;
}
return false;
}
add_filter( 'feed_links_show_comments_feed', 'twoia_hide_comment_feed_link' );