__( 'Header Menu', 'ycb' ), ) ); // Enable support for footer widgets. add_theme_support( 'genesis-footer-widgets', 4 ); // Enable viewport meta tag for mobile browsers. add_theme_support( 'genesis-responsive-viewport' ); // Enable HTML5 markup structure. add_theme_support( 'html5', array( 'caption', 'comment-form', 'comment-list', 'gallery', 'search-form', ) ); // Enable support for post formats. add_theme_support( 'post-formats', array( 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video', ) ); // Enable support for post thumbnails. add_theme_support( 'post-thumbnails' ); // Enable automatic output of WordPress title tags. add_theme_support( 'title-tag' ); // Enable support for WooCommerce. add_theme_support( 'woocommerce' ); // Enable selective refresh and Customizer edit icons. add_theme_support( 'customize-selective-refresh-widgets' ); // Enable theme support for custom background image. add_theme_support( 'custom-background', array( 'default-color' => 'f4f5f6', ) ); // Display custom logo. add_action( 'genesis_site_title', 'the_custom_logo', 1 ); // Add support for custom logo. add_theme_support( 'custom-logo', array( 'width' => 600, 'height' => 160, 'flex-width' => true, 'flex-height' => true, ) ); // Register default header (just in case). register_default_headers( array( 'child' => array( 'url' => '%2$s/assets/images/hero.jpg', 'thumbnail_url' => '%2$s/assets/images/hero.jpg', 'description' => __( 'Hero Image', 'ycb' ), ), ) ); // Register custom layout. genesis_register_layout( 'centered-content', array( 'label' => __( 'Centered Content', 'ycb' ), 'img' => get_stylesheet_directory_uri() . '/assets/images/layout.gif', ) ); // Register before footer widget area. genesis_register_sidebar( array( 'id' => 'before-footer', 'name' => __( 'Before Footer', 'ycb' ), 'description' => __( 'This is the before footer widget area.', 'ycb' ), ) ); add_action( 'genesis_footer', 'business_before_footer_widget_area', 5 ); /** * Display before-footer widget area. * * @since 1.0.0 * * @return void */ function business_before_footer_widget_area() { genesis_widget_area( 'before-footer', array( 'before' => '', ) ); } add_action( 'wp_enqueue_scripts', 'business_scripts_styles', 99 ); /** * Enqueue theme scripts and styles. * * @since 1.0.0 * * @return void */ function business_scripts_styles() { // Remove Simple Social Icons CSS (included with theme). wp_dequeue_style( 'simple-social-icons-font' ); // Enqueue Google fonts. //wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Montserrat:600|Hind:400', array(), CHILD_THEME_VERSION ); wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Roboto+Condensed:700|Roboto:300,500&subset=latin-ext,vietnamese', array(), CHILD_THEME_VERSION ); // Enqueue Line Awesome icon font. wp_enqueue_style( 'line-awesome', '//maxcdn.icons8.com/fonts/line-awesome/1.1/css/line-awesome-font-awesome.min.css', array(), CHILD_THEME_VERSION ); // Enqueue WooCommerce styles conditionally. global $post; if ( class_exists( 'WooCommerce' ) && ( has_shortcode( $post->post_content, 'products' ) || has_shortcode( $post->post_content, 'sale_products' ) || is_woocommerce() || is_front_page() || is_shop() || is_product_category() || is_product_tag() || is_product() || is_cart() || is_checkout() || is_account_page() ) ) { wp_enqueue_style( 'ycb-woocommerce', get_stylesheet_directory_uri() . '/assets/styles/min/woocommerce.min.css', array(), CHILD_THEME_VERSION ); } // Enqueue theme scripts. wp_enqueue_script( 'ycb', get_stylesheet_directory_uri() . '/assets/scripts/min/ycb.min.js', array( 'jquery' ), CHILD_THEME_VERSION, true ); // Enqueue responsive menu script. wp_enqueue_script( 'ycb-menu', get_stylesheet_directory_uri() . '/assets/scripts/min/menus.min.js', array( 'jquery' ), CHILD_THEME_VERSION, true ); // Localize responsive menus script. wp_localize_script( 'ycb-menu', 'genesis_responsive_menu', array( 'mainMenu' => __( 'Menu', 'ycb' ), 'subMenu' => __( 'Menu', 'ycb' ), 'menuIconClass' => null, 'subMenuIconClass' => null, 'menuClasses' => array( 'combine' => array( '.nav-primary', ), ), ) ); } // Load theme helper functions. include_once( get_stylesheet_directory() . '/includes/helpers.php' ); // Load Customizer settings and output. include_once( get_stylesheet_directory() . '/includes/customize.php' ); // Load default settings for the theme. include_once( get_stylesheet_directory() . '/includes/defaults.php' ); // Load theme's recommended plugins. include_once( get_stylesheet_directory() . '/includes/plugins.php' ); //* Remove the default header remove_action( 'genesis_header', 'genesis_do_header' ); //* Add Site Title in custom header add_action( 'genesis_header', 'ycb_do_header' ); function ycb_do_header() { if( function_exists( 'ubermenu' ) ) { ubermenu( 'main' , array( 'menu' => 16 ) ); wp_enqueue_style( 'ycb-ubermenu', get_stylesheet_directory_uri() . '/ubermenu.css', array(), CHILD_THEME_VERSION ); } genesis_markup( array( 'html5' => '
', 'xhtml' => '
', 'context' => 'title-area', ) ); do_action( 'genesis_site_title' ); do_action( 'genesis_site_description' ); echo '
'; genesis_markup( array( 'html5' => '', 'xhtml' => '
', ) ); } // Remove default stylesheet. wp_deregister_style( 'ycb' ); wp_dequeue_style( 'ycb' ); // Load minified child theme stylesheet. wp_register_style( 'ycb', get_stylesheet_directory_uri() . '/assets/styles/min/style.min.css', array(), CHILD_THEME_VERSION ); wp_enqueue_style( 'ycb' ); //Load custom css wp_register_style( 'ycb-custom', get_stylesheet_directory_uri() . '/custom.css', array(), CHILD_THEME_VERSION ); wp_enqueue_style( 'ycb-custom' ); add_filter( 'genesis_seo_title', 'custom_header_inline_logo', 10, 3 ); /** * Add an image inline in the site title element for the logo * * @param string $title Current markup of title. * @param string $inside Markup inside the title. * @param string $wrap Wrapping element for the title. * * @author @_AlphaBlossom * @author @_neilgee * @author @_JiveDig * @author @_srikat */ function custom_header_inline_logo( $title, $inside, $wrap ) { // If the custom logo function and custom logo exist, set the logo image element inside the wrapping tags. if ( function_exists( 'has_custom_logo' ) && has_custom_logo() ) { $inside = sprintf( '%s%s', esc_html( get_bloginfo( 'name' ) ), get_custom_logo() ); } else { // If no custom logo, wrap around the site name. $inside = sprintf( '%s', trailingslashit( home_url() ), esc_html( get_bloginfo( 'name' ) ) ); } // Build the title. $title = genesis_markup( array( 'open' => sprintf( "<{$wrap} %s>", genesis_attr( 'site-title' ) ), 'close' => "", 'content' => $inside, 'context' => 'site-title', 'echo' => false, 'params' => array( 'wrap' => $wrap, ), ) ); return $title; } add_filter( 'genesis_attr_site-description', 'custom_add_site_description_class' ); /** * Add class for screen readers to site description. * This will keep the site description markup but will not have any visual presence on the page * This runs if there is a logo image set in the Customizer. * * @param array $attributes Current attributes. * * @author @_neilgee * @author @_srikat */ function custom_add_site_description_class( $attributes ) { if ( function_exists( 'has_custom_logo' ) && has_custom_logo() ) { $attributes['class'] .= ' screen-reader-text'; } return $attributes; } add_filter( 'get_custom_logo', 'sk_custom_logo' ); /** * Filter the output of logo to add a custom class for the img element. * * @return string Custom logo markup. */ function sk_custom_logo() { $custom_logo_id = get_theme_mod( 'custom_logo' ); $html = sprintf( '', esc_url( home_url( '/' ) ), wp_get_attachment_image( $custom_logo_id, 'full', false, array( 'class' => 'custom-logo style-svg', 'itemprop' => 'logo', ) ) ); return $html; } //* Register webshop sidebar genesis_register_sidebar( array( 'id' => 'woocommerce-sidebar', 'name' => __( 'Woocommerce Sidebar', 'ycb' ), 'description' => __( 'This is the WooCommerce sidebar', 'ycb' ), ) ); //Remove default sidebar and add Woocommerce sidebar function themeprefix_remove_default_sidebar() { if( 'product' == get_post_type() ) {//set which pages remove_action( 'genesis_sidebar', 'ss_do_sidebar' ); remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); add_action( 'genesis_sidebar', 'themeprefix_add_woo_sidebar' ); } } //Alternative Sidebar function themeprefix_add_woo_sidebar() { dynamic_sidebar( 'woocommerce-sidebar' ); //add in the sidebar name } add_action( 'genesis_before_sidebar_widget_area', 'themeprefix_remove_default_sidebar' ); //sets the ball rolling //Sidebar-Content Layout on WooCommerce function themeprefix_cpt_layout() { if( is_shop() || is_tax( 'product_cat' ) || is_tax( 'product_tag' ) || is_tax('yith_product_brand') ) { return 'sidebar-content'; } } add_filter( 'genesis_site_layout', 'themeprefix_cpt_layout' );