tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); add_image_size( 'fudutheme-featured-image', 2000, 1200, true ); add_image_size( 'fudutheme-thumbnail-avatar', 100, 100, true ); add_image_size( 'fudutheme-logo', 244, 37, true ); add_image_size('thumbnail', 150, 150, true); add_image_size('medium_small', 300, 280, true); add_image_size('medium', 300, 300, true); add_image_size('medium_large', 768, 0, true); add_image_size('blog_single', 700, 450, true); add_image_size('large', 1024, 1024, true); // Set the default content width. $GLOBALS['content_width'] = 525; // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'top' => __( 'Top Menu', 'aztecs' ), 'footer' => __( 'Footer Menu', 'aztecs' ), 'footer-page-menu' => __( 'Footer Page Menu', 'aztecs' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'gallery', 'caption', ) ); /* * Enable support for Post Formats. * * See: https://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'audio', ) ); // Add theme support for Custom Logo. add_theme_support( 'custom-logo', array( 'width' => 250, 'height' => 250, 'flex-width' => true, ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, and column width. */ add_editor_style( array( 'assets/css/editor-style.css', aztecs_fonts_url() ) ); // Load regular editor styles into the new block-based editor. add_theme_support( 'editor-styles' ); // Load default block styles. add_theme_support( 'wp-block-styles' ); // Add support for responsive embeds. add_theme_support( 'responsive-embeds' ); // Define and register starter content to showcase the theme on new sites. $starter_content = array( 'widgets' => array( // Place three core-defined widgets in the sidebar area. 'sidebar-1' => array( 'text_business_info', 'search', 'text_about', ), // Add the core-defined business info widget to the footer 1 area. 'sidebar-2' => array( 'text_business_info', ), // Put two core-defined widgets in the footer 2 area. 'sidebar-3' => array( 'text_about', 'search', ), ), // Specify the core-defined pages to create and add custom thumbnails to some of them. 'posts' => array( 'home', 'about' => array( 'thumbnail' => '{{image-sandwich}}', ), 'contact' => array( 'thumbnail' => '{{image-espresso}}', ), 'blog' => array( 'thumbnail' => '{{image-coffee}}', ), 'homepage-section' => array( 'thumbnail' => '{{image-espresso}}', ), ), // Create the custom image attachments used as post thumbnails for pages. 'attachments' => array( 'image-espresso' => array( 'post_title' => _x( 'Espresso', 'Theme starter content', 'aztecs' ), 'file' => 'assets/images/espresso.jpg', // URL relative to the template directory. ), 'image-sandwich' => array( 'post_title' => _x( 'Sandwich', 'Theme starter content', 'aztecs' ), 'file' => 'assets/images/sandwich.jpg', ), 'image-coffee' => array( 'post_title' => _x( 'Coffee', 'Theme starter content', 'aztecs' ), 'file' => 'assets/images/coffee.jpg', ), ), // Default to a static front page and assign the front and posts pages. 'options' => array( 'show_on_front' => 'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}', ), // Set the front page section theme mods to the IDs of the core-registered pages. 'theme_mods' => array( 'panel_1' => '{{homepage-section}}', 'panel_2' => '{{about}}', 'panel_3' => '{{blog}}', 'panel_4' => '{{contact}}', ), // Set up nav menus for each of the two areas registered in the theme. 'nav_menus' => array( // Assign a menu to the "top" location. 'top' => array( 'name' => __( 'Top Menu', 'aztecs' ), 'items' => array( 'link_home', // Note that the core "home" page is actually a link in case a static front page is not used. 'page_about', 'page_blog', 'page_contact', ), ), // Assign a menu to the "social" location. 'social' => array( 'name' => __( 'Social Links Menu', 'aztecs' ), 'items' => array( 'link_yelp', 'link_facebook', 'link_twitter', 'link_instagram', 'link_email', ), ), ), ); /** * Filters Twenty Seventeen array of starter content. * * @since Twenty Seventeen 1.1 * * @param array $starter_content Array of starter content. */ $starter_content = apply_filters( 'aztecs_starter_content', $starter_content ); add_theme_support( 'starter-content', $starter_content ); } } add_action( 'after_setup_theme', 'aztecs_fudutheme_setup' ); /** * Register custom fonts. */ function aztecs_fonts_url() { $fonts_url = ''; /* * Translators: If there are characters in your language that are not * supported by Libre Franklin, translate this to 'off'. Do not translate * into your own language. */ $libre_franklin = _x( 'on', 'Libre Franklin font: on or off', 'aztecs' ); if ( 'off' !== $libre_franklin ) { $font_families = array(); $font_families[] = 'Libre Franklin:300,300i,400,400i,600,600i,800,800i'; $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return esc_url_raw( $fonts_url ); } if (!function_exists('aztecs_post_thumbnail')) { function aztecs_post_thumbnail() { get_template_part( 'template-parts/content/fst-thumbnail', 'thumbnail' ); } } if (!function_exists('aztecs_post_footer')){ function aztecs_post_footer() { get_template_part( 'template-parts/footer/fst-post', 'footer' ); } } /** * include theme function file. */ if (!function_exists('aztecs_fudutheme_init')) { function aztecs_fudutheme_init(){ require AZTECS_DIR . '/fst-framework/inc/fst-theme-function.php' ; } add_action('init', 'aztecs_fudutheme_init'); } if ( ! function_exists( 'aztecs_posted_by' ) ) { /** * Prints HTML with meta information about theme author. */ function aztecs_posted_by() { printf( /* translators: 1: SVG icon. 2: post author, only visible to screen readers. 3: author link. */ '%1$s%2$s%4$s', '', __( 'Posted by', 'aztecs' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_html( get_the_author() ) ); } } function aztecs_add_woocommerce_support() { add_theme_support( 'woocommerce' ); } add_action( 'after_setup_theme', 'aztecs_add_woocommerce_support' ); /* Function for admin menu orders */ function aztecs_custom_menu_order( $menu_ord ) { if ( !$menu_ord ) return true; return array( 'index.php', // Dashboard 'separator1', // First separator 'edit.php', // Posts 'upload.php', // Media 'link-manager.php', // Links 'edit.php?post_type=page', // Pages 'edit-comments.php', // Comments ); } add_filter( 'custom_menu_order', 'aztecs_custom_menu_order', 10, 1 ); add_filter( 'menu_order', 'aztecs_custom_menu_order', 10, 1 ); /* Set custom logo dimenstion */ function aztecs_custom_logo_dimension() { remove_theme_support( 'custom-logo' ); add_theme_support( 'custom-logo', array( 'width' => 290, 'height' => 50, 'flex-width' => true, 'flex-height' => true, ) ); } add_action( 'after_setup_theme', 'aztecs_custom_logo_dimension'); if ( is_admin() ) { require __DIR__.'/lib/class-tgm-plugin-activation.php' ; } /* Set active class on menu */ function aztecs_active_nav_class ($classes, $item) { if (in_array('current-menu-item', $classes) ) { $classes[] = 'active '; } return $classes; } add_filter('nav_menu_css_class' , 'aztecs_active_nav_class' , 10 , 2); require AZTECS_DIR . '/fst-framework/fst-framework.php'; require AZTECS_DIR . '/fst-framework/inc/fst-home-sections.php'; /* Updated Script and Styles Dequeue */ function aztecs_dequeue_styles() { if (is_home() || is_front_page()) { wp_dequeue_style( 'wp-block-library'); wp_deregister_style( 'wp-block-library'); wp_dequeue_style( 'wp-block-library-theme'); wp_dequeue_style( 'wc-block-style'); } } add_action( 'wp_print_styles', 'aztecs_dequeue_styles', 100 ); function aztecs_post_title($title) { $title = strip_tags($title); if (strlen($title) > 35) { $stringtitleCut = substr($title, 0, 35); $endtitlePoint = strrpos($stringtitleCut, ' '); $title = $endtitlePoint? substr($stringtitleCut, 0, $endtitlePoint) : substr($stringtitleCut, 0); $title .= '...'; } return $title; }