// Theme Supports add_theme_support('post-thumbnails'); add_theme_support('menu'); // Custom Logo function config_custom_logo() { add_theme_support('custom-logo'); } add_action('after_setup_theme', 'config_custom_logo'); // ✅ Enqueue Styles and Scripts function enqueue_theme_scripts_and_styles() { // Styles wp_enqueue_style('style', get_stylesheet_uri()); wp_enqueue_style('responsive', get_template_directory_uri() . '/assets/css/responsive.css', array(), null, 'all'); // ✅ Font Awesome (self-hosted) + font-display: swap wp_enqueue_style('local-fontawesome', get_template_directory_uri() . '/css/fontawesome.css'); wp_enqueue_style('local-fontawesome-swap', get_template_directory_uri() . '/css/fontawesome-swap.css'); // ✅ AOS CSS wp_enqueue_style('aos-css', 'https://cdn.jsdelivr.net/npm/aos@2.3.4/dist/aos.css', array(), '2.3.4'); // ✅ Swiper CSS wp_enqueue_style('swiper-css', 'https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.css', array(), null); // ✅ External JS Libraries (load in footer) wp_enqueue_script('aos-js', 'https://cdn.jsdelivr.net/npm/aos@2.3.4/dist/aos.js', array(), '2.3.4', true); wp_enqueue_script('swiper-js', 'https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.js', array(), null, true); wp_enqueue_script('popper-js', 'https://unpkg.com/@popperjs/core@2', array(), null, true); wp_enqueue_script('tippy-js', 'https://unpkg.com/tippy.js@6', array('popper-js'), null, true); // ✅ Your Theme JS (loaded after swiper) wp_enqueue_script( 'custom-script', get_template_directory_uri() . '/assets/js/script.js', array('swiper-js'), // Ensure Swiper is loaded before '1.0', true ); // ✅ Safe initializers for AOS and Tippy in the footer add_action('wp_footer', function () { echo ""; }); } add_action('wp_enqueue_scripts', 'enqueue_theme_scripts_and_styles', 0); // Load early // Register Menus function wpb_custom_new_menu() { register_nav_menus(array( 'main-navigation' => __('Main Navigation'), 'right-navigation' => __('Right Navigation'), 'footer-menu-1' => __('Footer Menu 1'), 'footer-menu-2' => __('Footer Menu 2'), 'footer-menu-3' => __('Footer Menu 3'), )); } add_action('init', 'wpb_custom_new_menu'); // Register Taxonomy: Type function create_type_tax() { $labels = array( 'name' => _x('Types', 'taxonomy general name', 'himenviro'), 'singular_name' => _x('Type', 'taxonomy singular name', 'himenviro'), 'search_items' => __('Search Types', 'himenviro'), 'all_items' => __('All Types', 'himenviro'), 'parent_item' => __('Parent Type', 'himenviro'), 'parent_item_colon' => __('Parent Type:', 'himenviro'), 'edit_item' => __('Edit Type', 'himenviro'), 'update_item' => __('Update Type', 'himenviro'), 'add_new_item' => __('Add New Type', 'himenviro'), 'new_item_name' => __('New Type Name', 'himenviro'), 'menu_name' => __('Type', 'himenviro'), ); $args = array( 'labels' => $labels, 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => true, 'show_admin_column' => true, 'show_in_rest' => true, ); register_taxonomy('type', array('info_download'), $args); } add_action('init', 'create_type_tax'); // Register Taxonomy: Business Area function create_businessarea_tax() { $labels = array( 'name' => _x('Business areas', 'taxonomy general name', 'himenviro'), 'singular_name' => _x('Business area', 'taxonomy singular name', 'himenviro'), 'search_items' => __('Search Business areas', 'himenviro'), 'all_items' => __('All Business areas', 'himenviro'), 'parent_item' => __('Parent Business area', 'himenviro'), 'parent_item_colon' => __('Parent Business area:', 'himenviro'), 'edit_item' => __('Edit Business area', 'himenviro'), 'update_item' => __('Update Business area', 'himenviro'), 'add_new_item' => __('Add New Business area', 'himenviro'), 'new_item_name' => __('New Business area Name', 'himenviro'), 'menu_name' => __('Business area', 'himenviro'), ); $args = array( 'labels' => $labels, 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_rest' => true, ); register_taxonomy('businessarea', array('info_download'), $args); } add_action('init', 'create_businessarea_tax'); // Register Taxonomy: Language function create_language_tax() { $labels = array( 'name' => _x('Languages', 'taxonomy general name', 'himenviro'), 'singular_name' => _x('Language', 'taxonomy singular name', 'himenviro'), 'search_items' => __('Search Languages', 'himenviro'), 'all_items' => __('All Languages', 'himenviro'), 'parent_item' => __('Parent Language', 'himenviro'), 'parent_item_colon' => __('Parent Language:', 'himenviro'), 'edit_item' => __('Edit Language', 'himenviro'), 'update_item' => __('Update Language', 'himenviro'), 'add_new_item' => __('Add New Language', 'himenviro'), 'new_item_name' => __('New Language Name', 'himenviro'), 'menu_name' => __('Language', 'himenviro'), ); $args = array( 'labels' => $labels, 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_rest' => true, ); register_taxonomy('language', array('info_download'), $args); } add_action('init', 'create_language_tax'); // Remove Block Editor Assets function remove_block_editor_css() { wp_dequeue_style('wp-block-library'); wp_dequeue_style('wp-block-library-theme'); wp_dequeue_style('wc-block-style'); wp_dequeue_style('storefront-gutenberg-blocks'); } add_action('wp_enqueue_scripts', 'remove_block_editor_css', 100); function remove_block_editor_js() { wp_dequeue_script('wp-block-library'); } add_action('wp_enqueue_scripts', 'remove_block_editor_js', 100); // Disable Gutenberg Editor add_filter('use_block_editor_for_post', '__return_false', 10); // Reading Time Shortcode function reading_time() { global $post; $content = get_post_field('post_content', $post->ID); $word_count = str_word_count(strip_tags($content)); $readingtime = ceil($word_count / 260); $timer = " min read"; return $readingtime . $timer; } add_shortcode('postbread', 'reading_time'); // Previous/Next Post Thumbnail add_filter('previous_post_link', 'sydney_child_post_nav_thumbnail', 20, 5); add_filter('next_post_link', 'sydney_child_post_nav_thumbnail', 20, 5); function sydney_child_post_nav_thumbnail($output, $format, $link, $post, $adjacent) { if (!$output || !$post) return; $divclass = ($adjacent === 'next') ? 'custom-nav nav-next' : 'custom-nav nav-previous'; $arrow = ''; $title = '