cart->cart_contents_count; return $fragments; } /** * Check footer widget status from page * * @static * @access public * @since 1.0.0 * @return bool * * @package Gutenbiz WordPress Theme */ public static function get_footer_widget(){ $disable_footer = self::get_meta( 'disable-footer-widget' ); if( is_page() && $disable_footer ){ return true; }elseif( self::is_active_plugin( 'woocommerce' ) && is_shop() && $disable_footer ){ # since 1.0.5 return true; }elseif( self::is_static_blog_page() && $disable_footer ){ # since 1.0.8 return true; } } /** * Register or modify customizer options * * @static * @access public * @since 1.0.0 * @return void * * @package Gutenbiz WordPress Theme */ public static function customize_register( $wp_customize ){ $color_section = self::with_prefix( 'color-section' ); $wp_customize->get_control( 'header_textcolor' )->section = $color_section; $wp_customize->get_control( 'background_color' )->section = $color_section; # changing header image to Inner Banner options and adding inside theme option panel $wp_customize->get_section( 'header_image' )->title = esc_html__( 'Inner Banner Options', 'gutenbiz' ); $wp_customize->get_section( 'header_image' )->panel = self::with_prefix( 'panel' ); } /** * Add meta fields for post and page * * @static * @access public * @return void * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function meta_fields(){ # meta box for sidebar options $post_types = array( 'page', 'post' ); $label = esc_html__( 'Gutenbiz Settings', 'gutenbiz' ); foreach ( $post_types as $type ) { $post = new Gutenbiz_Meta_Fields( $type ); $options = array( 'sidebar-position' => array( 'type' => 'select', 'label' => esc_html__( 'Sidebar Position:', 'gutenbiz' ), 'default' => 'customizer', 'choices' => array( 'customizer' => esc_html__( 'From customizer', 'gutenbiz' ), 'left-sidebar' => esc_html__( 'Left', 'gutenbiz' ), 'right-sidebar' => esc_html__( 'Right', 'gutenbiz' ), 'no-sidebar' => esc_html__( 'Hide', 'gutenbiz' ), ), ), ); if( 'page' == $type ){ $page_options = array( 'disable-inner-banner' => array( 'type' => 'checkbox', 'label' => esc_html__( 'Disable Banner', 'gutenbiz' ), ), 'disable-footer-widget' => array( 'type' => 'checkbox', 'label' => esc_html__( 'Disable Footer Widget', 'gutenbiz' ), ), ); $options = array_merge( $options, $page_options ); } $post->add_meta_box( $label, $options ); } } /** * print header * * @static * @return string * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function header(){ get_template_part( 'templates/header/header', 'main' ); } /** * Add a wrapper on inner banner and breadcrumb * * @static * @access public * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function the_inner_banner_content( ){ $disable = false; # inner banner should not load in 404 page, if( # don't load it in 404 page is_404() || ( ( is_page() || # don't load if disabled on page self::is_woo_shop_page() || # don't load if disabled on woocommerce shop page self::is_static_blog_page() || # don't load if disabled on static blog page self::is_static_front_page() # don't load if disabled on static homepage ) && self::get_meta( 'disable-inner-banner' ) ) || # remove banner on woocommerce category page self::is_woo_product_category() || # don't load it if it is blog page and title is empty ( is_home() && is_front_page() && !self::get_blog_title() ) ){ $disable = true; } # since 1.0.6 if( apply_filters( self::fn_prefix( 'disable_inner_banner_content' ), $disable) ){ return; } get_template_part( 'templates/content/content', 'banner' ); } /** * know if the page is woocommerce shop or not * * @static * @access public * @return bool * @since 1.0.5 * * @package Gutenbiz WordPress Theme */ public static function is_woo_shop_page(){ if( self::is_active_plugin( 'woocommerce' ) && is_shop() ){ return true; } } /** * know if the page is woocommerce single or not * * @static * @access public * @return bool * @since 1.0.5 * * @package Gutenbiz WordPress Theme */ public static function is_woo_single_page(){ if( self::is_active_plugin( 'woocommerce' ) && is_product() ){ return true; } } /** * know if the page is woocommerce category or not * * @static * @access public * @return bool * @since 1.0.5 * * @package Gutenbiz WordPress Theme */ public static function is_woo_product_category(){ if( self::is_active_plugin( 'woocommerce' ) && is_product_category() ){ return true; } } /** * Add a wrapper on excerpt * * @static * @access public * @return object * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function excerpt( $e ){ $more = sprintf( '%2$s', esc_url( get_the_permalink() ), esc_html__( 'Read More', 'gutenbiz' ) ); $new_content = str_replace( self::excerpt_more(), '', $e ); if( strlen( $new_content ) != strlen( $e ) ){ return '
' . $new_content . '
' . $more; } return '
' . $e . '
'; } /** * Add a wrapper on content * * @static * @access public * @return object * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function content( $c ){ return empty( $c ) ? $c : '
' . $c . '
'; } /** * Get excerpt length from customizer * * @static * @access public * @return interger * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function get_excerpt_length() { return gutenbiz_get( 'excerpt_length' ); } /** * when home page is latest posts this the custom title will be displayed. * * @static * @access public * @return string or false * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function get_blog_title(){ $ib_blog_title = gutenbiz_get( 'ib-blog-title' ); if( empty( $ib_blog_title ) ) { return false; }else{ return $ib_blog_title; } } /** * Show or Hide Breadcrumb * * @static * @access public * @return boolean * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function show_breadcrumb(){ if( is_front_page() || is_home() ) { return false; } return gutenbiz_get( 'show-breadcrumb' ); } /** * Show or Hide Preloader * * @static * @access public * @return boolean * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function show_preloader(){ return gutenbiz_get( 'pre-loader' ); } /** * Show or Hide post author in post and archive page * * @static * @access public * @return boolean * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function show_post_author(){ return gutenbiz_get( 'post-author' ); } /** * Show or Hide post date in post and archive page * * @static * @access public * @return boolean * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function show_post_date(){ return gutenbiz_get( 'post-date' ); } /** * Show or Hide post categories in post and archive page * * @static * @access public * @return boolean * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function show_post_category(){ return gutenbiz_get( 'post-category' ); } /** * Enqueue Gutenberg assets. * * @static * @access public * @return object * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function editor_assets(){ $scripts = array( array( 'handler' => self::with_prefix( 'block-editor-styles' ), 'style' => 'assets/css/block-editor-styles.css', 'in_footer' => false, ), ); self::enqueue( $scripts ); } /** * Add different supports to the theme * * @static * @access public * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function supports(){ # Gutenberg wide images. add_theme_support( 'align-wide' ); add_theme_support( 'wp-block-styles' ); # Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); # Let WordPress manage the document title. add_theme_support( 'title-tag' ); # Enable support for Post Thumbnails on posts and pages. add_theme_support( 'post-thumbnails' ); /*woocommerce support*/ add_theme_support( 'woocommerce' ); # Switch default core markup for search form, comment form, and comments. # to output valid HTML5. add_theme_support( 'html5', array( 'search-form', 'gallery', 'caption', ) ); # Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( self::fn_prefix( 'custom_background_args' ), array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); # Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); # Post formats. add_theme_support( 'post-formats', array( 'gallery', 'image', 'link', 'quote', 'video', 'audio', 'status', 'aside', ) ); # Add theme support for Custom Logo. add_theme_support( 'custom-logo', array( 'width' => 180, 'height' => 60, 'flex-width' => true, 'flex-height' => true, ) ); # Customize Selective Refresh Widgets. add_theme_support( 'customize-selective-refresh-widgets' ); add_theme_support( 'post-thumbnails' ); /** * This variable is intended to be overruled from themes. * Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}. * phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound */ $GLOBALS['content_width'] = apply_filters( 'content_width_setup', 640 ); /** * Make theme available for translation. * Translations can be filed in the /languages/ directory. */ load_theme_textdomain( 'gutenbiz', self::get_theme_path( 'languages' ) ); } /** * Register sidebar in theme * * @static * @access public * @return object * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function sidebars(){ # sidebar in post and pages register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'gutenbiz' ), 'id' => self::fn_prefix( 'sidebar' ), 'description' => esc_html__( 'Widgets in this area will be shown on side of the page.', 'gutenbiz' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); $description = esc_html__( 'Widgets in this area will be displayed in the {position} column in the footer. If empty then column will not be displayed.', 'gutenbiz' ); for( $i = 1; $i <= gutenbiz_get( 'layout-footer' ); $i++ ){ switch ($i){ case '1': $position = esc_html__( 'first', 'gutenbiz' ); break; case '2': $position = esc_html__( 'second', 'gutenbiz' ); break; case '3': $position = esc_html__( 'third', 'gutenbiz' ); break; case '4': $position = esc_html__( 'fourth', 'gutenbiz' ); break; default: $position = esc_html__( 'first', 'gutenbiz' ); } $msg = str_replace( '{position}', $position , $description ); register_sidebar( array( /* translators: %d: number of unexpected outputed characters */ 'name' => sprintf( esc_html__( 'Footer Widget Area %d ', 'gutenbiz' ), $i ), 'id' => self::fn_prefix( 'footer_sidebar' ) . '_' . $i, 'description' => $msg, 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } } /** * Register navigation bar * * @static * @access public * @return object * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function nav_menu(){ register_nav_menus( array( 'primary' => esc_html__( 'Primary', 'gutenbiz' ), 'social-menu-footer' => esc_html__( 'Footer social menu', 'gutenbiz' ) ) ); } /** * Includes the customizer theme options * * @static * @access public * @return object * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function load_theme_options(){ self::include( array( 'site-identity', 'typography', 'inner-banner-options', 'breadcrumb-options', 'footer-options', 'footer-author-options', 'color-options', 'post-options', 'sidebar-options', 'reset-options', 'advance-options', 'go-to-pro', ), 'inc/theme-options', '' ); } /** * Enqueue styles and scripts * * @static * @access public * @return object * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function scripts(){ $scripts = array( array( 'handler' => 'main-style', 'style' => 'style.css', 'minified' => false, ), array( 'handler' => 'bootstrap', 'style' => 'assets/css/vendor/bootstrap/bootstrap.css', 'version' => '4.3.1', ), #font awesome is register in customier icon-select control array( 'handler' => 'font-awesome', 'style' => 'assets/css/vendor/font-awesome/css/font-awesome.css', 'version' => '4.7.0' ), array( 'handler' => 'google-font', 'style' => self::get_google_font(), 'absolute' => true, ), array( 'handler' => 'block-style', 'style' => 'assets/css/blocks.css', ), array( 'handler' => 'theme-style', 'style' => 'assets/css/main.css', ), array( 'handler' => 'theme-script', 'script' => 'assets/js/main.js', ), ); #since 1.0.5 if( self::is_active_plugin( 'woocommerce' ) ){ $slick_scripts = array( array( 'handler' => 'slick-style', 'style' => '//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css', 'absolute' => true, 'minified' => false, ), array( 'handler' => 'slick-script', 'script' => '//cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js', 'absolute' => true, 'minified' => false, ), ); $scripts = array_merge( $scripts, $slick_scripts ); } # load rtl.css if site is RTL if( is_rtl() ){ $scripts[] = array( 'handler' => self::with_prefix( 'rtl' ), 'style' => 'rtl.css', 'minified' => false, ); } self::enqueue( $scripts ); # enqueue comment-reply.js in single page only if( ( is_single() || is_page() ) && comments_open() && get_option( 'thread_comments' ) ){ wp_enqueue_script( 'comment-reply' ); } } /** * Get class of sidebar to display in site * * @static * @access public * @return object * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function get_sidebar_class( $classes ){ $page_template = is_page_template( 'page-templates/full-width.php' ); if( $page_template || is_search() || self::is_woo_single_page() || self::is_woo_product_category() ){ $classes[] = self::with_prefix( 'no-sidebar' ); }else{ $customizer_position = gutenbiz_get( 'sidebar-position' ); $post_position = self::get_meta( 'sidebar-position' ); $post_position = $post_position == '' ? 'customizer' : $post_position; if( !self::is_woo_shop_page() && ( is_attachment() || is_archive() || self::is_latest_post_page() || 'customizer' == $post_position) ){ $classes[] = self::with_prefix( $customizer_position ); }elseif( $post_position ){ if( self::is_woo_shop_page() && 'customizer' == $post_position ) { $post_position = $customizer_position; } $classes[] = self::with_prefix( $post_position ); } } return apply_filters( self::with_prefix( 'get_sidebar_class' ), $classes ); } /** * Determines sidebar is active or not * * @static * @access public * @return boolean * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function is_sidebar_active(){ $cls = self::get_sidebar_class( array() ); return ! in_array( self::with_prefix( 'no-sidebar' ), $cls ); } /** * Adds sidebar in pages * * @static * @access public * @since 1.0.0 * * @package Gutenbiz WordPress Theme */ public static function the_sidebar(){ if( self::is_sidebar_active() ): ?> esc_html__( 'Rise Blocks - A Complete Gutenberg Page builder', 'gutenbiz' ), 'slug' => 'rise-blocks', 'required' => false, ), ); tgmpa( $plugins ); } /** * Adds Search icon inheader * * @static * @access public * @since 1.0.1 * * @package Gutenbiz WordPress Theme */ public static function add_search_icon(){ ?>
cart->cart_contents_count; $string = wc_get_cart_url(); ?> 0 ) ? esc_html( $count ) : 0; ?> parent() ? $new_theme->get_template() : false; $stylesheet = get_option( 'stylesheet' ); $lastActive = get_option( $stylesheet . '_last_active', false ); if ( ! $lastActive && $parent === $previous ) { # update "last_active" option so following code won't run again for this theme update_option( $stylesheet . '_last_active', current_time( 'timestamp', 1 ) ); # get the theme mods of the parent $previousMods = get_option( 'theme_mods_' . $parent, array() ); # update theme mods from parent theme to child theme update_option( 'theme_mods_' . $stylesheet, $previousMods ); } } } new Gutenbiz_Theme();