get('Version') ); // Enqueue main script with proper dependencies from asset file $asset_path = get_template_directory() . '/build/index.asset.php'; if (file_exists($asset_path)) { $asset_data = require $asset_path; wp_enqueue_script( 'caliph-theme-main', get_template_directory_uri() . '/build/index.js', $asset_data['dependencies'], $asset_data['version'], true ); } // Add inline CSS for skip link as backup $skip_link_css = " .skip-link { position: absolute !important; top: -40px !important; left: 6px !important; background: #000 !important; color: #fff !important; padding: 8px 16px !important; text-decoration: none !important; border-radius: 4px !important; z-index: 10000 !important; transition: top 0.3s ease !important; font-weight: bold !important; display: block !important; width: auto !important; height: auto !important; overflow: visible !important; clip: rect(1px, 1px, 1px, 1px); } .skip-link:focus { top: 42px !important; outline: 2px solid #fff !important; outline-offset: 2px !important; clip: auto !important; height: auto !important; width: auto !important; overflow: visible !important; } #main-content:focus { outline: none; } "; wp_add_inline_style('caliph-style-index', $skip_link_css); // Add hover effects CSS custom property based on setting $hover_effects_enabled = get_option('caliph_hover_effects', true); $hover_effects_css = ":root { --caliph-hover-effects-enabled: " . ($hover_effects_enabled ? '1' : '0') . "; }"; wp_add_inline_style('caliph-style-index', $hover_effects_css); // Enqueue accessibility script wp_enqueue_script( 'caliph-accessibility', get_template_directory_uri() . '/build/features/accessibility/index.js', array(), wp_get_theme()->get('Version'), true ); } add_action('wp_enqueue_scripts', 'caliph_enqueue_theme_scripts'); /** * Register custom blocks */ function caliph_register_blocks() { // Register the Marquee block $marquee_block_path = get_template_directory() . '/build/features/marquee'; if (file_exists($marquee_block_path . '/block.json')) { register_block_type_from_metadata($marquee_block_path); } // Register the Announcement Widget block $announcement_block_path = get_template_directory() . '/build/features/announcement-widget'; if (file_exists($announcement_block_path . '/block.json')) { register_block_type_from_metadata($announcement_block_path); } // Register the SVG Icon block $svg_icon_block_path = get_template_directory() . '/build/features/svg-icon-block'; if (file_exists($svg_icon_block_path . '/block.json')) { register_block_type_from_metadata($svg_icon_block_path); } // Register the Accordion block $accordion_block_path = get_template_directory() . '/build/features/accordion-block'; if (file_exists($accordion_block_path . '/block.json')) { register_block_type_from_metadata($accordion_block_path); } // Register the Responsive Navigation Menu block $responsive_nav_menu_block_path = get_template_directory() . '/build/features/responsive-nav-menu'; if (file_exists($responsive_nav_menu_block_path . '/block.json')) { register_block_type_from_metadata($responsive_nav_menu_block_path); } // Register the Card Widget block $card_widget_block_path = get_template_directory() . '/build/features/card-widget'; if (file_exists($card_widget_block_path . '/block.json')) { register_block_type_from_metadata($card_widget_block_path); } } add_action('init', 'caliph_register_blocks'); // Add skip link for accessibility at the very top of the body add_action('wp_body_open', function() { echo ''; }); // Custom blocks are now registered through block.json metadata in caliph_register_blocks() /** * Initialize the theme * * Creates a singleton instance of the main theme class. * This ensures the theme is properly initialized with all required functionality. */ if (class_exists('Caliph_Theme')) { Caliph_Theme::get_instance(); }