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);
     }
 }
 /**
  * Get the post id to use to display a header
  * For example, if a header is set for the blog, we will use it for the archive and search page
  *
  * @return int $id
  */
 function wolf_get_header_post_id()
 {
     if (is_404() || is_page_template('page-templates/home.php')) {
         return;
     }
     $post_id = null;
     $shop_page_id = wolf_get_woocommerce_shop_page_id();
     $is_shop_page = function_exists('is_shop') ? is_shop() : false;
     $is_product_taxonomy = function_exists('is_product_taxonomy') ? is_product_taxonomy() : false;
     $is_single_product = function_exists('is_product') ? is_product() : false;
     // is blog
     if (get_option('page_for_posts') && wolf_is_blog() && false == $is_shop_page && false == $is_product_taxonomy) {
         $post_id = get_option('page_for_posts');
         // if woocommerce
     } elseif ($is_shop_page || $is_product_taxonomy) {
         $post_id = $shop_page_id;
         // is single product
     } elseif ($is_single_product) {
         if (get_post_meta(get_the_ID(), '_header_bg_img', true) || get_post_meta(get_the_ID(), '_header_bg_color', true)) {
             $post_id = get_the_ID();
         } else {
             $post_id = $shop_page_id;
         }
     } else {
         $post_id = get_the_ID();
     }
     return $post_id;
 }
 /**
  * Closes Article Wrapper on Shop page
  */
 public function shop_page_wrapper_end()
 {
     if (!is_shop()) {
         return;
     }
     echo '</article>';
 }
Example #4
0
function flatsome_admin_bar_helper()
{
    global $wp_admin_bar;
    $optionUrl = get_admin_url() . 'themes.php?page=optionsframework';
    $adminUrl = get_admin_url();
    if (is_category() || is_home()) {
        $wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Blog Layout', 'href' => $optionUrl . '&tab=of-option-blog'));
    }
    if (ux_is_woocommerce_active()) {
        if (is_checkout() || is_cart()) {
            $wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Checkout Settings', 'href' => $adminUrl . 'admin.php?page=wc-settings&tab=checkout'));
        }
        if (is_product()) {
            $wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Product Page Layout', 'href' => $optionUrl . '&tab=of-option-productpage'));
        }
        if (is_account_page()) {
            $wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'My Account Page', 'href' => $adminUrl . 'admin.php?page=wc-settings&tab=account'));
        }
        if (is_shop() || is_product_category()) {
            $wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Shop Settings'));
            $wp_admin_bar->add_menu(array('parent' => 'admin_bar_helper', 'id' => 'admin_bar_helper_flatsome', 'title' => 'Category Page Layout', 'href' => $optionUrl . '&tab=of-option-categorypage'));
            $wp_admin_bar->add_menu(array('parent' => 'admin_bar_helper', 'id' => 'admin_bar_helper_woocommerce', 'title' => 'Shop Page Display', 'href' => $adminUrl . 'admin.php?page=wc-settings&tab=products&section=display'));
        }
    }
}
 /**
  * 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 #6
0
function custom_pre_get_posts_query($q)
{
    if (!$q->is_main_query()) {
        return;
    }
    if (!$q->is_post_type_archive()) {
        return;
    }
    if (is_shop() && isset($_GET['sort'])) {
        $show = array();
        if ($_GET['indica'] == 1) {
            $show[] = 'Indica';
        }
        if ($_GET['sativa'] == 1) {
            $show[] = 'Sativa';
        }
        if ($_GET['hybrid'] == 1) {
            $show[] = 'Hybrid';
        }
        if ($_GET['con'] == 1) {
            $show[] = 'Concentrates';
        }
        if ($_GET['pen'] == 1) {
            $show[] = 'Vapor Pens';
        }
        if ($_GET['all'] == 1) {
            $show = array('Indica', 'Sativa', 'Hybrid', 'Concentrates', 'Vapor Pens');
        }
        $q->set('tax_query', array(array('taxonomy' => 'product_cat', 'field' => 'slug', 'terms' => $show, 'operator' => 'IN')));
    }
    remove_action('pre_get_posts', 'custom_pre_get_posts_query');
}
Example #7
0
function xt_get_page_ID()
{
    global $wp_query, $post;
    $page_id = false;
    if (is_home() && get_option('page_for_posts')) {
        $page_id = get_option('page_for_posts');
    } elseif (is_front_page() && get_option('page_on_front')) {
        $page_id = get_option('page_on_front');
    } else {
        if (function_exists('is_shop') && is_shop() && get_option('woocommerce_shop_page_id') != '') {
            $page_id = get_option('woocommerce_shop_page_id');
        } else {
            if (function_exists('is_cart') && is_cart() && get_option('woocommerce_cart_page_id') != '') {
                $page_id = get_option('woocommerce_cart_page_id');
            } else {
                if (function_exists('is_checkout') && is_checkout() && get_option('woocommerce_checkout_page_id') != '') {
                    $page_id = get_option('woocommerce_checkout_page_id');
                } else {
                    if (function_exists('is_account_page') && is_account_page() && get_option('woocommerce_myaccount_page_id') != '') {
                        $page_id = get_option('woocommerce_myaccount_page_id');
                    } else {
                        if ($wp_query && !empty($wp_query->queried_object) && !empty($wp_query->queried_object->ID)) {
                            $page_id = $wp_query->queried_object->ID;
                        } else {
                            if (!empty($post->ID)) {
                                $page_id = $post->ID;
                            }
                        }
                    }
                }
            }
        }
    }
    return $page_id;
}
function jbst_layout()
{
    global $jbst_layout;
    global $jbstecommerce;
    global $post;
    if ($jbst_layout) {
        return;
    }
    /* get the page layout */
    $jbst_layout = jbst_default_page_layout;
    if (is_singular(array('page', 'post'))) {
        if (!($jbst_layout = get_post_meta($post->ID, '_cmb_page_layout', true))) {
            $jbst_layout = of_get_option('default_page_layout', jbst_default_page_layout);
        }
    } else {
        if (is_page() || is_home()) {
            $jbst_layout = of_get_option('default_page_layout', jbst_default_page_layout);
        } elseif (is_search()) {
            $jbst_layout = of_get_option('default_search_layout', jbst_default_page_layout);
        } elseif (is_archive()) {
            $jbst_layout = of_get_option('default_archive_layout', jbst_default_page_layout);
        } else {
            $jbst_layout = of_get_option('default_blog_layout', jbst_default_page_layout);
        }
        if ($jbstecommerce == true) {
            if (is_shop()) {
                $jbst_layout = of_get_option('default_shop_layout', jbst_default_page_layout);
            }
            if (is_product()) {
                $jbst_layout = of_get_option('default_product_layout', jbst_default_page_layout);
            }
        }
    }
}
Example #9
0
 function global_get_post_id() {
     if (function_exists('is_woocommerce') && is_woocommerce() && is_shop()) {
         
         return wc_get_page_id('shop');
     } 
     else if (is_singular()) {
         global $post;
         
         return $post->ID;
     } 
     else if (is_home()) {
         
         $page_on_front = get_option('page_on_front');
         $show_on_front = get_option('show_on_front');
         
         if ($page_on_front == 'page' && !empty($page_on_front)) {
             global $post;
             return $post->ID;
         } 
         else {
             return false;
         }
     } 
     else {
         
         return false;
     }
 }
Example #10
0
function woa_remove_sidebar_shop_page()
{
    if (is_shop() || is_tax('product_cat') || get_post_type() == 'product') {
        remove_action('storefront_sidebar', 'storefront_get_sidebar', 10);
        add_filter('body_class', 'woa_remove_sidebar_class_body', 10);
    }
}
/**
 * Adds custom classes to the array of body classes.
 *
 * @since vantage 1.0
 */
function vantage_body_classes($classes)
{
    // Adds a class of group-blog to blogs with more than 1 published author
    if (is_multi_author()) {
        $classes[] = 'group-blog';
    }
    if (siteorigin_setting('layout_responsive')) {
        $classes[] = 'responsive';
    }
    $classes[] = 'layout-' . siteorigin_setting('layout_bound');
    $classes[] = 'no-js';
    $is_full_width_template = is_page_template('templates/template-full.php') || is_page_template('templates/template-full-notitle.php');
    if (!$is_full_width_template) {
        $wc_shop_sidebar = vantage_is_woocommerce_active() && is_shop() && is_active_sidebar('shop');
        if (!is_active_sidebar('sidebar-1') && !$wc_shop_sidebar) {
            $classes[] = 'no-sidebar';
        } else {
            $classes[] = 'has-sidebar';
        }
    }
    if (wp_is_mobile()) {
        $classes[] = 'so-vantage-mobile-device';
    }
    $mega_menu_active = function_exists('max_mega_menu_is_enabled') && max_mega_menu_is_enabled('primary');
    if (siteorigin_setting('navigation_menu_search') && !$mega_menu_active) {
        $classes[] = 'has-menu-search';
    }
    if (siteorigin_setting('layout_force_panels_full')) {
        $classes[] = 'panels-style-force-full';
    }
    return $classes;
}
Example #12
0
function ep_addVCCustomCss()
{
    $shortcodes_custom_css = '';
    //if is main-page
    if (is_page_template('main-page.php')) {
        $page_ids = get_all_page_ids();
        $current_page_id = get_the_ID();
        if (count($page_ids) > 0) {
            foreach ($page_ids as $page_id) {
                $separate_page = get_post_meta($page_id, "page-position-switch", true);
                if ($separate_page !== "0" && $page_id != $current_page_id) {
                    $shortcodes_custom_css .= get_post_meta($page_id, '_wpb_shortcodes_custom_css', true);
                }
            }
            if ($shortcodes_custom_css != '') {
                echo '<style type="text/css" data-type="vc_shortcodes-custom-css">';
                echo $shortcodes_custom_css;
                echo '</style>';
            }
        }
    } else {
        if (function_exists("is_shop")) {
            $shortcodes_custom_css = get_post_meta(woocommerce_get_page_id('shop'), '_wpb_shortcodes_custom_css', true);
            if (is_shop() && $shortcodes_custom_css != '') {
                echo '<style type="text/css" data-type="vc_shortcodes-custom-css">';
                echo $shortcodes_custom_css;
                echo '</style>';
            }
        }
    }
}
 /**
  * get the current page ID.
  *
  * @return  int the current page ID.
  */
 public function page_id()
 {
     global $post;
     if (isset($post)) {
         /**
          * Get the current post ID
          */
         $id = $post->ID;
         /**
          * If we're on the posts page, get the ID of the page
          * using the 'page_for_posts' option.
          */
         if (is_home()) {
             $id = get_option('page_for_posts');
         } else {
             /**
              * I we're on the WooCommerce shop page, get the ID of the page
              * using the 'woocommerce_shop_page_id' option
              */
             if (function_exists('is_shop') && is_shop()) {
                 $id = get_option('woocommerce_shop_page_id');
             } else {
                 /**
                  * If this is a  singular page/post then set ID to the page ID.
                  * If not, then set it to false.
                  */
                 $id = is_singular() ? $post->ID : false;
             }
         }
     } else {
         $id = false;
     }
     return $id;
 }
 /**
  * Init theme config for shop.
  *
  * @param string $name
  */
 function dt_woocommerce_configure_template($name = '')
 {
     dt_woocommerce_configure_mini_cart();
     // Add template configuration actions.
     $config = presscore_config();
     $mod_wc_config = dt_woocommerce_template_config($config);
     add_action('dt_wc_loop_start', array($mod_wc_config, 'setup'));
     add_action('dt_wc_loop_end', array($mod_wc_config, 'cleanup'));
     // Stop if not on woocommerce page.
     if ('shop' !== $name) {
         return;
     }
     // From what page get settings?
     $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');
             }
         }
     }
     if ($post_id) {
         $config->set('post_id', $post_id);
     }
     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 #15
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;
}
function title_for_shop($title)
{
    if (is_shop()) {
        return __('Shop', THEMEDOMAIN);
    }
    return $title;
}
 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 #19
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');
}
Example #20
0
function ewf_wooshop_remove_title()
{
    if (is_shop()) {
        return false;
    }
    return true;
}
Example #21
0
 function rd_after_container()
 {
     $post_sidebar = '';
     if (is_product()) {
         if (get_field('product_sidebar')) {
             $post_sidebar = get_field('product_sidebar');
         }
         if ($post_sidebar == 'sidebar_default' || empty($post_sidebar)) {
             $post_sidebar = rd_options('reedwan_woo_product_sidebar_position');
         }
     } elseif (is_shop()) {
         $pageID = get_option('woocommerce_shop_page_id');
         if (get_field('page_sidebar', $pageID)) {
             $post_sidebar = get_field('page_sidebar', $pageID);
         }
         if ($post_sidebar == 'sidebar_default' || empty($post_sidebar)) {
             $post_sidebar = rd_options('reedwan_woo_archive_sidebar_position');
         }
     } elseif (is_product_category() || is_product_tag()) {
         $post_sidebar = rd_options('reedwan_woo_archive_sidebar_position');
     } else {
         $post_sidebar = 'sidebar_none';
     }
     echo '</div>';
     if ($post_sidebar != 'sidebar_none') {
         echo '<div class="sidebar grid_3">';
         if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('woo-sidebar')) {
         }
         echo '</div>';
     }
     echo '</div></div></div>';
 }
/**
 * Change the Shop archive page title.
 * @param  string $title
 * @return string
 */
function wc_custom_shop_archive_title($title)
{
    if (is_shop()) {
        return str_replace(__('Products', 'woocommerce'), 'Artwork', $title);
    }
    return $title;
}
Example #23
0
 function woothemes_add_javascript()
 {
     global $woo_options;
     wp_register_script('prettyPhoto', get_template_directory_uri() . '/includes/js/jquery.prettyPhoto.js', array('jquery'));
     wp_register_script('enable-lightbox', get_template_directory_uri() . '/includes/js/enable-lightbox.js', array('jquery', 'prettyPhoto'));
     wp_register_script('google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
     wp_register_script('google-maps-markers', get_template_directory_uri() . '/includes/js/markers.js');
     wp_register_script('flexslider', get_template_directory_uri() . '/includes/js/jquery.flexslider-min.js', array('jquery'));
     wp_register_script('featured-slider', get_template_directory_uri() . '/includes/js/featured-slider.js', array('jquery', 'flexslider'));
     wp_register_script('infinite-scroll', get_template_directory_uri() . '/includes/js/jquery.infinitescroll.min.js', array('jquery'));
     wp_register_script('masonry', get_template_directory_uri() . '/includes/js/jquery.masonry.min.js', array('jquery'));
     wp_enqueue_script('third party', get_template_directory_uri() . '/includes/js/third-party.js', array('jquery'));
     wp_enqueue_script('tiptip', get_template_directory_uri() . '/includes/js/jquery.tiptip.min.js', array('jquery'));
     wp_enqueue_script('general', get_template_directory_uri() . '/includes/js/general.js', array('jquery'));
     // Load Google Script on Contact Form Page Template
     if (is_page_template('template-contact.php')) {
         wp_enqueue_script('google-maps');
         wp_enqueue_script('google-maps-markers');
     }
     // End If Statement
     // Load infinite scroll on shop page / product cats
     if (is_woocommerce_activated()) {
         if ($woo_options['woocommerce_archives_infinite_scroll'] == 'true' && (is_shop() || is_product_category())) {
             wp_enqueue_script('infinite-scroll');
         }
     }
     // Load Masonry on the blog grid layout
     if (is_page_template('template-blog-grid.php')) {
         wp_enqueue_script('masonry');
         add_action('wp_head', 'woo_fire_masonry');
     }
     do_action('woothemes_add_javascript');
 }
Example #24
0
 function quark_woocommerce_before_main_content()
 {
     if (is_shop() && !of_get_option('woocommerce_shopsidebar', '1') || is_product() && !of_get_option('woocommerce_productsidebar', '1')) {
         echo '<div class="col grid_12_of_12">';
     } else {
         echo '<div class="col grid_10_of_12 offset_1">';
     }
 }
Example #25
0
function x_is_shop()
{
    if (function_exists('is_shop') && is_shop()) {
        return true;
    } else {
        return false;
    }
}
function add_shop_class($classes)
{
    if (is_shop()) {
        //$classes[] = $post->post_type . '-' . $post->post_name;
        $classes[] = 'page-shop';
    }
    return $classes;
}
Example #27
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 #29
0
 /**
  * Removes the confusing body.woocommerce so it is easier and more
  * reliable to target the elements within WooCommerce implementation
  *
  * @param  array $classes
  * @return array
  */
 function cargopress_woo_body_class($classes)
 {
     $classes = (array) $classes;
     if (is_shop()) {
         $classes[] = 'woocommerce-shop-page';
     }
     return $classes;
 }
function shorten_product_title($title, $id)
{
    if (is_shop() && get_post_type($id) === 'product' && strlen($title) > 50) {
        return substr($title, 0, 50) . '...';
    } else {
        return $title;
    }
}