'defer', 'in_footer' => true] ); } }, 20); /** * Preload self-hosted Inter fonts to reduce LCP. * * Only emits for fonts that actually exist on disk — * silent during early dev when the WOFF2 files have not been dropped yet. */ add_action('wp_head', function () { $fonts = [ 'Inter-Variable.woff2', // 'InterDisplay-Variable.woff2', ]; foreach ($fonts as $font) { $path = AV_THEME_DIR . '/assets/fonts/' . $font; if (file_exists($path)) { printf( '' . "\n", esc_url(AV_THEME_URI), esc_attr($font) ); } } }, 1); /** * Modular includes. * * Each file is opt-in via file_exists() so partial scaffolds don't fatal. */ $av_includes = [ 'inc/cpt.php', // Custom post types: case_study, scenario. 'inc/seo.php', // Schema.org JSON-LD overrides. 'inc/form-handler.php', // Conversion form POST handler. ]; foreach ($av_includes as $av_include) { $path = AV_THEME_DIR . '/' . $av_include; if (file_exists($path)) { require_once $path; } } unset($av_include, $path); /** * Theme support and custom image sizes. * * Image sizes per Design Handoff section 8.3: * - hero 2400×1350 (16:9) * - card 800×600 (4:3) * - thumb 400×300 (4:3) */ add_action('after_setup_theme', function () { add_theme_support('post-thumbnails'); add_theme_support('html5', [ 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script', ]); add_theme_support('responsive-embeds'); add_theme_support('align-wide'); add_theme_support('editor-styles'); add_image_size('av-hero', 2400, 1350, true); add_image_size('av-card', 800, 600, true); add_image_size('av-thumb', 400, 300, true); load_child_theme_textdomain('asterion-bricks', AV_THEME_DIR . '/languages'); }); /** * Hide the WP admin bar on frontend for non-admins (cleaner preview screenshots). */ add_action('after_setup_theme', function () { if (! current_user_can('administrator')) { show_admin_bar(false); } }); /** * Disable Gutenberg block library default styles when Bricks is active — * we own typography end-to-end through tokens.css. */ add_action('wp_enqueue_scripts', function () { wp_dequeue_style('wp-block-library'); wp_dequeue_style('wp-block-library-theme'); wp_dequeue_style('global-styles'); wp_dequeue_style('classic-theme-styles'); }, 100);