function setup_gridlist()
 {
     if (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy()) {
         add_action('wp_enqueue_scripts', array($this, 'setup_scripts_script'), 20);
         add_action('woocommerce_before_shop_loop', array($this, 'gridlist_toggle_button'), 10);
     }
 }
Example #2
0
function siw_remove_unnecessary_scripts()
{
    //variatie als radiobuttons
    if (!is_product()) {
        wp_dequeue_script('kt-wc-add-to-cart-variation-radio');
    }
    //woocommerce ajax filter
    if (!is_shop() && !is_product_category() && !is_product_tag()) {
        wp_dequeue_script('yith-wcan-script');
        wp_dequeue_style('yith-wcan-frontend');
    }
    //woocommerce
    wp_dequeue_script('woocommerce');
    //wp-embed
    wp_deregister_script('wp-embed');
    //search&filter
    wp_dequeue_style('search-filter-chosen-styles');
    wp_dequeue_style('search-filter-plugin-styles');
    wp_deregister_script('search-filter-chosen-script');
    wp_deregister_script('jquery-ui-datepicker');
    wp_deregister_script('search-filter-plugin-build');
    wp_register_script('search-filter-plugin-build', plugins_url('search-filter-pro/public/assets/js/search-filter-build.min.js'), array('jquery'), '', TRUE);
    //kadence slider wordt alleen gebruikt op de homepage.
    if (!is_front_page()) {
        wp_dequeue_script('kadence_slider_js');
        wp_dequeue_style('kadence_slider_css');
    }
    //ncf font
    wp_dequeue_style('ncf_lato_font');
    //styling van mailpoet widget
    wp_deregister_style('validate-engine-css');
}
 public function wcva_register_shop_scripts()
 {
     if (is_shop() || is_product_category() || is_product_tag()) {
         wp_enqueue_script('wcva-shop-frontend', '' . wcva_PLUGIN_URL . 'js/shop-frontend.js', array('jquery'));
         wp_enqueue_style('wcva-shop-frontend', '' . wcva_PLUGIN_URL . 'css/shop-frontend.css');
     }
 }
function tesseract_woocommerce_wrapper_start()
{
    $layout_loop = get_theme_mod('tesseract_woocommerce_loop_layout');
    $layout_product = get_theme_mod('tesseract_woocommerce_product_layout');
    if (is_shop() || is_product_category() || is_product_tag()) {
        if ($layout_loop == 'sidebar-left' || $layout_loop == 'sidebar-right') {
            $primclass = 'with-sidebar';
            $primclass .= $layout_loop == 'sidebar-left' ? ' sidebar-left' : ' sidebar-right';
        } else {
            if ($layout_loop == 'fullwidth' || !$layout_loop) {
                $primclass = 'no-sidebar';
            }
        }
    } else {
        if (is_product()) {
            if ($layout_product == 'sidebar-left' || $layout_product == 'sidebar-right') {
                $primclass = 'with-sidebar';
                $primclass .= $layout_product == 'sidebar-left' ? ' sidebar-left' : ' sidebar-right';
            } else {
                if ($layout_product == 'fullwidth' || !$layout_product) {
                    $primclass = 'no-sidebar';
                }
            }
        } else {
            $primclass = 'sidebar-default';
        }
    }
    echo '<div id="primary" class="content-area ' . $primclass . '">';
}
Example #5
0
/**
 * Get theme option value
 * @param string $option
 * @return mix|boolean
 */
function ts_get_opt($option)
{
    global $ts_theme_options;
    $local = false;
    //get local from main shop page
    if (class_exists('WooCommerce') && (is_shop() || is_product_category() || is_product_tag())) {
        $shop_page = woocommerce_get_page_id('shop');
        if (!empty($shop_page)) {
            $value = ts_get_post_opt($option . '-local', (int) $shop_page);
            $local = true;
        }
        //get local from metaboxes for the post value and override if not empty
    } else {
        if (is_singular()) {
            $value = ts_get_post_opt($option . '-local');
            $local = true;
        }
    }
    //return local value if exists
    if ($local === true) {
        //if $value is an array we need to check if first element is not empty before we return $value
        $first_element = null;
        if (is_array($value)) {
            $first_element = reset($value);
        }
        if (is_string($value) && (strlen($value) > 0 || !empty($value)) || is_array($value) && !empty($first_element)) {
            return $value;
        }
    }
    if (isset($ts_theme_options[$option])) {
        return $ts_theme_options[$option];
    }
    return false;
}
 /**
  * Init theme config for shop.
  *
  */
 function dt_woocommerce_init_template_config($name = '')
 {
     dt_woocommerce_add_config_actions();
     if ('shop' != $name) {
         return;
     }
     $config = presscore_get_config();
     $post_id = null;
     if (is_shop()) {
         $post_id = woocommerce_get_page_id('shop');
     } else {
         if (is_cart()) {
             $post_id = woocommerce_get_page_id('cart');
         } else {
             if (is_checkout()) {
                 $post_id = woocommerce_get_page_id('checkout');
             }
         }
     }
     presscore_config_base_init($post_id);
     if (is_product_category() || is_product_tag()) {
         $post_id = woocommerce_get_page_id('shop');
         if ($post_id) {
             $config->set('post_id', $post_id);
             presscore_config_populate_sidebar_and_footer_options();
             $config->set('post_id', null);
         }
     }
     if (!is_product()) {
         add_filter('presscore_get_page_title', 'dt_woocommerce_get_page_title', 20);
     }
     // replace theme breadcrumbs
     add_filter('presscore_get_breadcrumbs-html', 'dt_woocommerce_replace_theme_breadcrumbs', 20, 2);
 }
Example #7
0
 function setup_scripts_script()
 {
     if (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy()) {
         wp_enqueue_script('cookie', plugins_url('/assets/js/jquery.cookie.min.js', __FILE__), array('jquery'));
         wp_enqueue_script('grid-list-scripts', plugins_url('/assets/js/jquery.gridlistview.min.js', __FILE__), array('jquery'));
         add_action('wp_footer', array(&$this, 'gridlist_set_default_view'));
     }
 }
/**
 * WooCommerce conditionals
 *
 * is_woocommerce - Returns true if on a page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and thus are not included)
 **/
function is_woocommerce()
{
    if (is_shop() || is_product_category() || is_product_tag() || is_product()) {
        return true;
    } else {
        return false;
    }
}
Example #9
0
function kadence_sidebar_id()
{
    if (is_front_page()) {
        global $virtue;
        if (!empty($virtue['home_sidebar'])) {
            $sidebar = $virtue['home_sidebar'];
        } else {
            $sidebar = 'sidebar-primary';
        }
    } else {
        if (class_exists('woocommerce') and is_shop() || is_product_category() || is_product_tag()) {
            global $virtue;
            if (!empty($virtue['shop_sidebar'])) {
                $sidebar = $virtue['shop_sidebar'];
            } else {
                $sidebar = 'sidebar-primary';
            }
        } elseif (class_exists('woocommerce') and is_account_page()) {
            get_template_part('templates/account', 'sidebar');
            $sidebar = "";
        } elseif (is_page_template('page-blog.php') || is_page_template('page-sidebar.php') || is_page_template('page-feature-sidebar.php') || get_post_type() == 'post') {
            global $post;
            $sidebar_name = get_post_meta($post->ID, '_kad_sidebar_choice', true);
            if (!empty($sidebar_name)) {
                $sidebar = $sidebar_name;
            } else {
                $sidebar = 'sidebar-primary';
            }
        } else {
            if (is_archive()) {
                $sidebar = 'sidebar-primary';
            } else {
                if (is_category()) {
                    $sidebar = 'sidebar-primary';
                } elseif (is_tag()) {
                    $sidebar = 'sidebar-primary';
                } elseif (is_post_type_archive()) {
                    $sidebar = 'sidebar-primary';
                } elseif (is_day()) {
                    $sidebar = 'sidebar-primary';
                } elseif (is_month()) {
                    $sidebar = 'sidebar-primary';
                } elseif (is_year()) {
                    $sidebar = 'sidebar-primary';
                } elseif (is_author()) {
                    $sidebar = 'sidebar-primary';
                } elseif (is_search()) {
                    $sidebar = 'sidebar-primary';
                } else {
                    $sidebar = 'sidebar-primary';
                }
            }
        }
    }
    return apply_filters('kadence_sidebar_id', $sidebar);
}
Example #10
0
function amt_is_woocommerce_product_group()
{
    // Check if woocommerce product group page and return true;
    // WooCommerce (http://docs.woothemes.com/document/conditional-tags/)
    // Also validates with is_tax().
    if (function_exists('is_product_category') || function_exists('is_product_tag')) {
        if (is_product_category() || is_product_tag()) {
            return true;
        }
    }
}
Example #11
0
function nimber_show_per_row()
{
    if (is_shop()) {
        $woo_layout = ot_get_option('woo_layout');
    } elseif (is_product_category() || is_product_tag()) {
        $woo_layout = ot_get_option('woo_archive_layout');
    } else {
        $woo_layout = 4;
    }
    return $woo_layout;
}
 /**
  * Get current page URL for layered nav items.
  *
  * @return string
  */
 protected function get_page_base_url()
 {
     if (defined('SHOP_IS_ON_FRONT')) {
         $link = home_url();
     } elseif (is_post_type_archive('product') || is_page(wc_get_page_id('shop'))) {
         $link = get_post_type_archive_link('product');
     } elseif (is_product_category()) {
         $link = get_term_link(get_query_var('product_cat'), 'product_cat');
     } elseif (is_product_tag()) {
         $link = get_term_link(get_query_var('product_tag'), 'product_tag');
     } else {
         $queried_object = get_queried_object();
         $link = get_term_link($queried_object->slug, $queried_object->taxonomy);
     }
     // Min/Max
     if (isset($_GET['min_price'])) {
         $link = add_query_arg('min_price', wc_clean($_GET['min_price']), $link);
     }
     if (isset($_GET['max_price'])) {
         $link = add_query_arg('max_price', wc_clean($_GET['max_price']), $link);
     }
     // Orderby
     if (isset($_GET['orderby'])) {
         $link = add_query_arg('orderby', wc_clean($_GET['orderby']), $link);
     }
     /**
      * Search Arg.
      * To support quote characters, first they are decoded from &quot; entities, then URL encoded.
      */
     if (get_search_query()) {
         $link = add_query_arg('s', rawurlencode(htmlspecialchars_decode(get_search_query())), $link);
     }
     // Post Type Arg
     if (isset($_GET['post_type'])) {
         $link = add_query_arg('post_type', wc_clean($_GET['post_type']), $link);
     }
     // Min Rating Arg
     if (isset($_GET['min_rating'])) {
         $link = add_query_arg('min_rating', wc_clean($_GET['min_rating']), $link);
     }
     // All current filters
     if ($_chosen_attributes = WC_Query::get_layered_nav_chosen_attributes()) {
         foreach ($_chosen_attributes as $name => $data) {
             $filter_name = sanitize_title(str_replace('pa_', '', $name));
             if (!empty($data['terms'])) {
                 $link = add_query_arg('filter_' . $filter_name, implode(',', $data['terms']), $link);
             }
             if ('or' == $data['query_type']) {
                 $link = add_query_arg('query_type_' . $filter_name, 'or', $link);
             }
         }
     }
     return $link;
 }
 function setup_gridlist()
 {
     if (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy()) {
         add_action('wp_enqueue_scripts', array($this, 'setup_scripts_styles'), 20);
         add_action('wp_enqueue_scripts', array($this, 'setup_scripts_script'), 20);
         add_action('woocommerce_before_shop_loop', array($this, 'gridlist_toggle_button'), 30);
         add_action('woocommerce_after_shop_loop_item', array($this, 'gridlist_buttonwrap_open'), 9);
         add_action('woocommerce_after_shop_loop_item', array($this, 'gridlist_buttonwrap_close'), 11);
         add_action('woocommerce_after_shop_loop_item', array($this, 'gridlist_hr'), 30);
         add_action('woocommerce_after_shop_loop_item', 'woocommerce_template_single_excerpt', 5);
         add_action('woocommerce_after_subcategory', array($this, 'gridlist_cat_desc'));
     }
 }
Example #14
0
function kadence_sidebar_on_shop_page()
{
    global $virtue;
    if (isset($virtue['shop_layout']) && $virtue['shop_layout'] == 'sidebar') {
        if (is_shop() || is_product_category() || is_product_tag()) {
            return false;
        }
    } else {
        if (is_shop() || is_product_category() || is_product_tag()) {
            return true;
        }
    }
}
Example #15
0
 /**
  * Get sidebar settings based on the page type
  *
  * @return array
  */
 public function sidebar_options()
 {
     if (is_home()) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('blog_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('blog_archive_sidebar_2'), 'position' => Avada()->settings->get('blog_sidebar_position'));
     } elseif (function_exists('is_bbpress') && is_bbpress()) {
         $sidebars = array('global' => Avada()->settings->get('bbpress_global_sidebar'), 'sidebar_1' => Avada()->settings->get('ppbress_sidebar'), 'sidebar_2' => Avada()->settings->get('ppbress_sidebar_2'), 'position' => Avada()->settings->get('bbpress_sidebar_position'));
         if (bbp_is_forum_archive() || bbp_is_topic_archive() || bbp_is_user_home() || bbp_is_search()) {
             $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('ppbress_sidebar'), 'sidebar_2' => Avada()->settings->get('ppbress_sidebar_2'), 'position' => Avada()->settings->get('bbpress_sidebar_position'));
         }
     } elseif (function_exists('is_buddypress') && is_buddypress()) {
         $sidebars = array('global' => Avada()->settings->get('bbpress_global_sidebar'), 'sidebar_1' => Avada()->settings->get('ppbress_sidebar'), 'sidebar_2' => Avada()->settings->get('ppbress_sidebar_2'), 'position' => Avada()->settings->get('bbpress_sidebar_position'));
     } elseif (class_exists('WooCommerce') && (is_product() || is_shop())) {
         $sidebars = array('global' => Avada()->settings->get('woo_global_sidebar'), 'sidebar_1' => Avada()->settings->get('woo_sidebar'), 'sidebar_2' => Avada()->settings->get('woo_sidebar_2'), 'position' => Avada()->settings->get('woo_sidebar_position'));
     } elseif (class_exists('WooCommerce') && (is_product_category() || is_product_tag())) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('woocommerce_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('woocommerce_archive_sidebar_2'), 'position' => Avada()->settings->get('woo_sidebar_position'));
     } elseif (is_page()) {
         $sidebars = array('global' => Avada()->settings->get('pages_global_sidebar'), 'sidebar_1' => Avada()->settings->get('pages_sidebar'), 'sidebar_2' => Avada()->settings->get('pages_sidebar_2'), 'position' => Avada()->settings->get('default_sidebar_pos'));
     } elseif (is_single()) {
         $sidebars = array('global' => Avada()->settings->get('posts_global_sidebar'), 'sidebar_1' => Avada()->settings->get('posts_sidebar'), 'sidebar_2' => Avada()->settings->get('posts_sidebar_2'), 'position' => Avada()->settings->get('blog_sidebar_position'));
         if (is_singular('avada_portfolio')) {
             $sidebars = array('global' => Avada()->settings->get('portfolio_global_sidebar'), 'sidebar_1' => Avada()->settings->get('portfolio_sidebar'), 'sidebar_2' => Avada()->settings->get('portfolio_sidebar_2'), 'position' => Avada()->settings->get('portfolio_sidebar_position'));
         } else {
             if (is_singular('tribe_events') || is_singular('tribe_organizer') || is_singular('tribe_venue')) {
                 $sidebars = array('global' => Avada()->settings->get('ec_global_sidebar'), 'sidebar_1' => Avada()->settings->get('ec_sidebar'), 'sidebar_2' => Avada()->settings->get('ec_sidebar_2'), 'position' => Avada()->settings->get('ec_sidebar_pos'));
             }
         }
         if (is_singular('tribe_organizer') || is_singular('tribe_venue')) {
             $sidebars['global'] = 1;
         }
     } elseif (is_archive()) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('blog_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('blog_archive_sidebar_2'), 'position' => Avada()->settings->get('blog_sidebar_position'));
         if (is_post_type_archive('avada_portfolio') || is_tax('portfolio_category') || is_tax('portfolio_skills') || is_tax('portfolio_tags')) {
             $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('portfolio_archive_sidebar'), 'sidebar_2' => Avada()->settings->get('portfolio_archive_sidebar_2'), 'position' => Avada()->settings->get('portfolio_sidebar_position'));
         }
     } elseif (is_search()) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('search_sidebar'), 'sidebar_2' => Avada()->settings->get('search_sidebar_2'), 'position' => Avada()->settings->get('search_sidebar_position'));
     } else {
         $sidebars = array('global' => Avada()->settings->get('pages_global_sidebar'), 'sidebar_1' => Avada()->settings->get('pages_sidebar'), 'sidebar_2' => Avada()->settings->get('pages_sidebar_2'), 'position' => Avada()->settings->get('default_sidebar_pos'));
     }
     if (class_exists('Tribe__Events__Main') && is_events_archive()) {
         $sidebars = array('global' => '1', 'sidebar_1' => Avada()->settings->get('ec_sidebar'), 'sidebar_2' => Avada()->settings->get('ec_sidebar_2'), 'position' => Avada()->settings->get('ec_sidebar_pos'));
     }
     // Remove sidebars from the certain woocommerce pages
     if (class_exists('WooCommerce')) {
         if (is_cart() || is_checkout() || is_account_page() || get_option('woocommerce_thanks_page_id') && is_page(get_option('woocommerce_thanks_page_id'))) {
             $sidebars = array();
         }
     }
     return $sidebars;
 }
 /**
  * This function configure sidebar and footer as for the 'shop' woocommerce page.
  *
  * @param string $name
  */
 function dt_woocommerce_configure_archive_templates($name = '')
 {
     if ('shop' !== $name) {
         return;
     }
     if (is_product_category() || is_product_tag()) {
         $post_id = woocommerce_get_page_id('shop');
         if ($post_id) {
             presscore_get_config()->set('post_id', $post_id);
             presscore_config_populate_sidebar_and_footer_options();
             presscore_get_config()->set('post_id', null);
         }
     }
 }
Example #17
0
function cs_wc_loop_add_to_cart_scripts()
{
    if (is_shop() || is_product_category() || is_product_tag() || is_product()) {
        ?>
<script>
    jQuery( document ).ready( function( $ ) {
        $( document ).on( 'change', '.quantity .qty', function() {
            $( this ).parent( '.quantity' ).next( '.add_to_cart_button' ).attr( 'data-quantity', $( this ).val() );
        });
    });
</script>

    <?php 
    }
}
 function getPost()
 {
     $data = new stdClass();
     global $post, $wp_query;
     $categoryId = (int) get_query_var('cat');
     if (function_exists('is_woocommerce') && is_woocommerce()) {
         $data->post = get_post(get_option('woocommerce_shop_page_id'));
         if (is_product()) {
             $data->post = $post;
         } elseif (is_product_category() || is_product_tag()) {
             $data->post->post_title = ThemeHelper::esc_html($wp_query->queried_object->name);
         } elseif (is_search()) {
             $data->post->post_title = sprintf(__('Search products for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
         }
         setup_postdata($data->post);
     } else {
         if (is_tag()) {
             $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
             $tagQuery = get_query_var('tag');
             $tagData = get_tags(array('slug' => $tagQuery));
             $data->post->post_title = esc_html($tagData[0]->name);
         } elseif (is_author()) {
             $author = get_userdata(get_query_var('author'));
             $data->post = get_post(ThemeOption::getOption('blog_author_post_id'));
             $data->post->post_title = sprintf(__('All posts from %s', THEME_DOMAIN), get_the_author_meta('display_name', $author->data->ID));
         } elseif (is_category($categoryId)) {
             $category = get_category($categoryId);
             $data->post = get_post(ThemeOption::getOption('blog_category_post_id'));
             $data->post->post_title = ThemeHelper::esc_html($category->name);
         } elseif (is_day()) {
             $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
             $data->post->post_title = get_the_date();
         } elseif (is_archive()) {
             $data->post = get_post(ThemeOption::getOption('blog_archive_post_id'));
             $data->post->post_title = single_month_title(' ', false);
         } elseif (is_search()) {
             $data->post = get_post(ThemeOption::getOption('blog_search_post_id'));
             $data->post->post_title = sprintf(__('Kết quả tìm kiếm: <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s')));
         } elseif (is_404()) {
             $data->post = get_post(ThemeOption::getOption('page_404_page_id'));
             $data->post->post_title = $data->post->post_title;
         } else {
             return false;
         }
     }
     return $data;
 }
 /**
  * Register the integration conditions with WooSidebars.
  * @since  1.1.0
  * @param  array $conditions The existing array of conditions.
  * @return array             The modified array of conditions.
  */
 public function register_conditions($conditions)
 {
     global $post;
     if (function_exists('is_woocommerce') && !is_woocommerce()) {
         return $conditions;
     }
     $integration = array();
     if (function_exists('is_shop') && is_shop()) {
         $integration[] = 'wc-shop_page';
     }
     if (function_exists('is_product_category') && is_product_category()) {
         $integration[] = 'wc-product_category';
     }
     if (function_exists('is_product_tag') && is_product_tag()) {
         $integration[] = 'wc-product_tag';
     }
     if (function_exists('is_cart') && is_cart()) {
         $integration[] = 'wc-cart';
     }
     if (function_exists('is_checkout') && is_checkout()) {
         $integration[] = 'wc-checkout';
     }
     if (function_exists('is_account_page') && is_account_page()) {
         $integration[] = 'wc-account';
     }
     if (function_exists('is_product') && is_product()) {
         $integration[] = 'wc-product';
         $categories = get_the_terms($post->ID, 'product_cat');
         if (!is_wp_error($categories) && is_array($categories) && count($categories) > 0) {
             foreach ($categories as $k => $v) {
                 $integration[] = 'in-term-' . esc_attr($v->term_id);
             }
         }
         $tags = get_the_terms($post->ID, 'product_tag');
         if (!is_wp_error($tags) && is_array($tags) && count($tags) > 0) {
             foreach ($tags as $k => $v) {
                 $integration[] = 'in-term-' . esc_attr($v->term_id);
             }
         }
     }
     $integration[] = $conditions[count($conditions) - 1];
     array_splice($conditions, count($conditions), 0, $integration);
     return $conditions;
 }
Example #20
0
 /**
  * Returns the current layout type and defines WPV_LAYOUT accordingly
  *
  * @return string current page layout
  */
 public static function get_layout()
 {
     global $post;
     if (!defined('WPV_LAYOUT_TYPE')) {
         if (wpv_has_woocommerce()) {
             $id_override = is_single() ? $post->ID : (woocommerce_get_page_id('shop') ? woocommerce_get_page_id('shop') : null);
             if (is_shop() || is_product_category() || is_product_tag()) {
                 define('WPV_LAYOUT_TYPE', wpv_post_meta_default('layout-type', 'default-body-layout', $id_override));
                 return WPV_LAYOUT_TYPE;
             }
         }
         if (is_404() || is_page_template('page-blank.php')) {
             define('WPV_LAYOUT_TYPE', 'full');
             define('WPV_LAYOUT', 'no-sidebars');
             return WPV_LAYOUT_TYPE;
         }
         $layout_type = '';
         if (is_singular(WpvFramework::$complex_layout) || wpv_has_woocommerce() && is_woocommerce()) {
             $layout_type = wpv_post_meta_default('layout-type', 'default-body-layout');
         } else {
             $layout_type = wpv_get_option('default-body-layout');
         }
         if (empty($layout_type)) {
             $layout_type = 'full';
         }
         define('WPV_LAYOUT_TYPE', $layout_type);
         switch ($layout_type) {
             case 'left-only':
                 define('WPV_LAYOUT', 'left-sidebar');
                 break;
             case 'right-only':
                 define('WPV_LAYOUT', 'right-sidebar');
                 break;
             case 'left-right':
                 define('WPV_LAYOUT', 'two-sidebars');
                 break;
             case 'full':
                 define('WPV_LAYOUT', 'no-sidebars');
                 break;
         }
         return $layout_type;
     }
     return WPV_LAYOUT_TYPE;
 }
Example #21
0
 /**
  * Output WooCommerce content.
  *
  * This function is only used in the optional 'woocommerce.php' template
  * which people can add to their themes to add basic woocommerce support
  * without hooks or modifying core templates.
  *
  * @access public
  * @return void
  */
 function woocommerce_content()
 {
     remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20);
     remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30);
     remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20);
     remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5);
     if (is_product()) {
         woocommerce_get_template('single-product.php');
         //  archive-product.php
     } elseif (is_product_category()) {
         woocommerce_get_template('taxonomy-product_cat.php');
         //  archive-product.php
     } elseif (is_product_tag()) {
         woocommerce_get_template('taxonomy-product_tag.php');
         //  archive-product.php
     } else {
         woocommerce_get_template('archive-product.php');
     }
 }
Example #22
0
 function wpex_woo_layout_class()
 {
     $woo_shop_layout = wpex_option('woo_shop_layout', 'full-width');
     $woo_product_layout = wpex_option('woo_product_layout', 'full-width');
     $classes = array();
     // Main Shop & archives
     if (is_shop() || is_product_category() || is_product_tag()) {
         $classes[] = $woo_shop_layout;
     }
     // Single Products
     if (is_singular('product')) {
         $classes[] = $woo_product_layout;
     }
     // Filter for devs
     $classes = apply_filters('wpex_woo_wrap_classes', $classes);
     // Ninja work
     $classes = implode(" ", $classes);
     // Return classes
     return $classes;
 }
Example #23
0
function wpbase_wrapper_start()
{
    if (is_product_category() && !is_active_sidebar('wpbasewooarchiveaside')) {
        echo '<article class="product_archive_big">';
    } elseif (is_product_category() && is_active_sidebar('wpbasewooarchiveaside')) {
        echo '<article class="product_archive_small">';
    } elseif (is_product_tag() && is_active_sidebar('wpbasewooarchiveaside')) {
        echo '<article class="product_tag_small">';
    } elseif (is_product_tag() && !is_active_sidebar('wpbasewooarchiveaside')) {
        echo '<article class="product_tag_big">';
    } elseif (is_product() && is_active_sidebar('wpbasewooleft')) {
        echo '<article class="product first-aside">';
    } elseif (is_product() && !is_active_sidebar('wpbasewooleft')) {
        echo '<article class="product no-aside">';
    } elseif (is_shop() && is_active_sidebar('wpbasewooarchiveaside')) {
        echo '<article class="shop first-aside">';
    } elseif (is_shop() && !is_active_sidebar('wpbasewooarchiveaside')) {
        echo '<article class="shop no-aside">';
    }
}
Example #24
0
/**
 * Adds custom classes to the array of body classes.
 *
 * @since 1.0
 * @param array $classes Classes for the body element.
 * @return array
 */
function bigboom_body_classes($classes)
{
    // Adds a class of group-blog to blogs with more than 1 published author.
    if (is_multi_author()) {
        $classes[] = 'group-blog';
    }
    // Add a class of layout
    $classes[] = bigboom_get_layout();
    // Add a class of shop
    if (isset($_COOKIE['shop_view']) && function_exists('is_shop') && (is_shop() || is_product_category() || is_product_tag())) {
        $classes[] = 'shop-view-' . $_COOKIE['shop_view'];
    }
    // Add a class for color scheme
    if (intval(bigboom_theme_option('custom_color_scheme')) && bigboom_theme_option('custom_color_1')) {
        $classes[] = 'custom-color-scheme';
    } else {
        $classes[] = bigboom_theme_option('color_scheme');
    }
    return $classes;
}
    /**
     * Display main content open tags and fire hooks.
     */
    function dt_woocommerce_before_main_content()
    {
        // remove woocommerce breadcrumbs
        remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20);
        // only for shop
        if (is_shop() || is_product_category() || is_product_tag()) {
            // remove woocommerce title
            add_filter('woocommerce_show_page_title', '__return_false');
        } else {
            if (is_product()) {
                $config = presscore_get_config();
                if ('disabled' != $config->get('header_title')) {
                    // remove product title
                    remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5);
                }
            }
        }
        ?>
		<!-- Content -->
		<div id="content" class="content" role="main">
	<?php 
    }
Example #26
0
            get_sidebar();
            echo '</div><!--/span_9-->';
            break;
        case 'left-sidebar':
            echo '<div id="sidebar" class="col span_3">';
            get_sidebar();
            echo '</div><!--/span_9-->';
            echo '<div id="post-area" class="col span_9 col_last">';
            woocommerce_content();
            echo '</div><!--/span_9-->';
            break;
        default:
            woocommerce_content();
            break;
    }
} elseif (is_shop() || is_product_category() || is_product_tag()) {
    if ($main_shop_layout == 'right-sidebar' || $main_shop_layout == 'left-sidebar') {
        add_filter('loop_shop_columns', 'loop_columns');
    }
    switch ($main_shop_layout) {
        case 'no-sidebar':
            woocommerce_content();
            break;
        case 'right-sidebar':
            echo '<div id="post-area" class="col span_9">';
            woocommerce_content();
            echo '</div><!--/span_9-->';
            echo '<div id="sidebar" class="col span_3 col_last">';
            get_sidebar();
            echo '</div><!--/span_9-->';
            break;
Example #27
0
function x_is_product_tag()
{
    if (function_exists('is_product_tag') && is_product_tag()) {
        return true;
    } else {
        return false;
    }
}
Example #28
0
 /**
  * Function that returns current page title text. Defines qode_title_text filter
  * @return string current page title text
  *
  * @see is_tag()
  * @see is_date()
  * @see is_author()
  * @see is_category()
  * @see is_home()
  * @see is_search()
  * @see is_404()
  * @see get_queried_object_id()
  * @see qode_is_woocommerce_installed()
  *
  * @since 4.3
  * @version 0.1
  *
  */
 function qode_get_title_text()
 {
     global $qode_options_proya;
     $id = get_queried_object_id();
     $title = '';
     //is current page tag archive?
     if (is_tag()) {
         //get title of current tag
         $title = single_term_title("", false) . " Tag";
     } elseif (is_date()) {
         //get current date archive format
         $title = get_the_time('F Y');
     } elseif (is_author()) {
         //get current author name
         $title = __('Author:', 'qode') . " " . get_the_author();
     } elseif (is_category()) {
         //get current page category title
         $title = single_cat_title('', false);
     } elseif (is_home() && is_front_page()) {
         //get site name from options
         $title = get_option('blogname');
     } elseif (is_search()) {
         //get title for search page
         $title = __('Search', 'qode');
     } elseif (is_404()) {
         //is 404 title text set in theme options?
         if ($qode_options_proya['404_title'] != "") {
             //get it from options
             $title = $qode_options_proya['404_title'];
         } else {
             //get default 404 page title
             $title = __('404 - Page not found', 'qode');
         }
     } elseif (qode_is_woocommerce_installed() && (is_shop() || is_singular('product'))) {
         //get shop page id from options table
         $shop_id = get_option('woocommerce_shop_page_id');
         //get shop page and get it's title if set
         $shop = get_post($shop_id);
         if (isset($shop->post_title) && $shop->post_title !== '') {
             $title = $shop->post_title;
         }
     } elseif (qode_is_woocommerce_installed() && (is_product_category() || is_product_tag())) {
         global $wp_query;
         //get current taxonomy and it's name and assign to title
         $tax = $wp_query->get_queried_object();
         $category_title = $tax->name;
         $title = $category_title;
     } elseif (is_archive()) {
         $title = __('Archive', 'qode');
     } else {
         $title = get_the_title($id);
     }
     $title = apply_filters('qode_title_text', $title);
     return $title;
 }
					<div class="clearfix"></div>
					<?php 
if (!is_shop() && !is_product() && !is_product_category() && !is_product_tag()) {
    echo '</div><!-- /ql_background -->';
}
?>
				
        	</div><!-- /content -->
Example #30
0
function dh_get_main_class($body = false)
{
    $class = dh_get_main_col_class('', $body);
    if (is_home() || is_front_page()) {
        $layout = dh_get_theme_option('blog-layout', 'right-sidebar');
        $class = dh_get_main_col_class($layout, $body);
    } elseif (is_post_type_archive('portfolio') || is_tax('portfolio_category')) {
        $layout = dh_get_theme_option('portfolio-main-layout', 'full-width');
        $class = dh_get_main_col_class($layout, $body);
    } elseif (is_archive() || is_search()) {
        $layout = dh_get_theme_option('archive-layout', 'full-width');
        $class = dh_get_main_col_class($layout, $body);
    } elseif (is_singular('portfolio')) {
        $layout = dh_get_theme_option('portfolio-single-layout', 'full-width');
        $class = dh_get_main_col_class($layout, $body);
    } elseif (is_single()) {
        $layout = dh_get_theme_option('single-layout', 'right-sidebar');
        $class = dh_get_main_col_class($layout, $body);
    } else {
        $layout = dh_get_theme_option('main-layout', 'right-sidebar');
        $class = dh_get_main_col_class($layout, $body);
    }
    if (defined('WOOCOMMERCE_VERSION')) {
        if (is_shop()) {
            remove_action('dh_left_sidebar', 'dh_get_sidebar');
            remove_action('dh_left_sidebar_extra', 'dh_get_extra_sidebar');
            remove_action('dh_right_sidebar', 'dh_get_sidebar');
            remove_action('dh_right_sidebar_extra', 'dh_get_extra_sidebar');
            $layout = dh_get_theme_option('woo-shop-layout', 'full-width');
            $class = dh_get_main_col_class($layout, $body, 11);
        } elseif (is_product_category() || is_product_tag() || is_product_taxonomy()) {
            remove_action('dh_left_sidebar', 'dh_get_sidebar');
            remove_action('dh_left_sidebar_extra', 'dh_get_extra_sidebar');
            remove_action('dh_right_sidebar', 'dh_get_sidebar');
            remove_action('dh_right_sidebar_extra', 'dh_get_extra_sidebar');
            $layout = dh_get_theme_option('woo-category-layout', 'right-sidebar');
            $class = dh_get_main_col_class($layout, $body, 11);
        } elseif (is_product()) {
            remove_action('dh_left_sidebar', 'dh_get_sidebar');
            remove_action('dh_left_sidebar_extra', 'dh_get_extra_sidebar');
            remove_action('dh_right_sidebar', 'dh_get_sidebar');
            remove_action('dh_right_sidebar_extra', 'dh_get_extra_sidebar');
            $layout = dh_get_theme_option('woo-product-layout', 'full-width');
            $class = dh_get_main_col_class($layout, $body, 11);
        }
    }
    if ($body) {
        return $class;
    }
    $class .= ' main-wrap';
    $class = apply_filters('dh_get_main_class', $class);
    return esc_attr($class);
}