/**
 * Remove WooCommerce Generator tag, styles, and scripts from the homepage.
 * Tested and works with WooCommerce 2.0+
 *
 * @author Greg Rickaby
 * @since 2.0.0
 */
function child_manage_woocommerce_styles()
{
    remove_action('wp_head', array($GLOBALS['woocommerce'], 'generator'));
    if (!is_woocommerce() && !is_cart() && !is_checkout()) {
        wp_dequeue_style('woocommerce_frontend_styles');
        wp_dequeue_style('woocommerce_fancybox_styles');
        wp_dequeue_style('woocommerce_chosen_styles');
        wp_dequeue_style('woocommerce_prettyPhoto_css');
        wp_dequeue_script('wc_price_slider');
        wp_dequeue_script('wc-single-product');
        wp_dequeue_script('wc-add-to-cart');
        wp_dequeue_script('wc-cart-fragments');
        wp_dequeue_script('wc-checkout');
        wp_dequeue_script('wc-add-to-cart-variation');
        wp_dequeue_script('wc-single-product');
        wp_dequeue_script('wc-cart');
        wp_dequeue_script('wc-chosen');
        wp_dequeue_script('woocommerce');
        wp_dequeue_script('prettyPhoto');
        wp_dequeue_script('prettyPhoto-init');
        wp_dequeue_script('jquery-blockui');
        wp_dequeue_script('jquery-placeholder');
        wp_dequeue_script('fancybox');
        wp_dequeue_script('jqueryui');
    }
}
Beispiel #2
0
/**
 * Get page layout
 *
 * @param string $default Default layout
 *
 * @return string
 */
function constructent_layout($default = 'sidebar-right')
{
    // Default layout
    $layout = $default;
    // Site layout
    if ($site_layout = constructent_option('site_layout')) {
        $layout = $site_layout;
    }
    // Singular page can have custom layout
    if (is_page()) {
        $custom_layout = constructent_meta('layout');
        if ($custom_layout && constructent_meta('custom_layout')) {
            $layout = $custom_layout;
        } else {
            $layout = constructent_option('page_layout');
        }
    }
    // Shop page layout
    if (function_exists('is_woocommerce') && is_woocommerce()) {
        $layout = constructent_option('shop_layout');
    }
    // Layout Full content
    if (is_page_template('tpl/portfolio.php') || is_singular('portfolio') || is_404()) {
        $layout = 'full-content';
    }
    if (is_tax('portfolio_category') && constructent_option('portfolio_columns')) {
        $layout = 'full-content';
    }
    // Allow to filter
    $layout = apply_filters(__FUNCTION__, $layout);
    return $layout;
}
Beispiel #3
0
 function wpex_get_sidebar($sidebar = 'sidebar')
 {
     // Pages
     $custom_pages_sidebar = wpex_option('pages_custom_sidebar', '1');
     if (is_singular('pages') && $custom_pages_sidebar == '1') {
         return 'pages_sidebar';
     }
     // Staff
     $custom_staff_sidebar = wpex_option('staff_custom_sidebar', '1');
     if (is_singular('staff') && $custom_staff_sidebar == '1') {
         return 'staff_sidebar';
     }
     // Portfolio
     $custom_portfolio_sidebar = wpex_option('portfolio_custom_sidebar', '1');
     if (is_singular('portfolio') && $custom_portfolio_sidebar == '1') {
         return 'portfolio_sidebar';
     }
     // WooCommerce
     if (class_exists('Woocommerce')) {
         $woo_custom_sidebar = wpex_option('woo_custom_sidebar', '1');
         if ($woo_custom_sidebar == '1' && is_woocommerce()) {
             return 'woo_sidebar';
         }
     }
     // Return the correct sidebar name & add useful hook
     return apply_filters('wpex_get_sidebar', $sidebar);
 }
function child_manage_woocommerce_styles()
{
    //remove generator meta tag
    remove_action('wp_head', array($GLOBALS['woocommerce'], 'generator'));
    //first check that woo exists to prevent fatal errors
    if (function_exists('is_woocommerce')) {
        //dequeue scripts and styles
        if (!is_woocommerce() && !is_cart() && !is_checkout()) {
            wp_dequeue_style('woocommerce_frontend_styles');
            wp_dequeue_style('woocommerce_fancybox_styles');
            wp_dequeue_style('woocommerce_chosen_styles');
            wp_dequeue_style('woocommerce_prettyPhoto_css');
            wp_dequeue_script('wc_price_slider');
            wp_dequeue_script('wc-single-product');
            wp_dequeue_script('wc-add-to-cart');
            wp_dequeue_script('wc-cart-fragments');
            wp_dequeue_script('wc-checkout');
            wp_dequeue_script('wc-add-to-cart-variation');
            wp_dequeue_script('wc-single-product');
            wp_dequeue_script('wc-cart');
            wp_dequeue_script('wc-chosen');
            wp_dequeue_script('woocommerce');
            wp_dequeue_script('prettyPhoto');
            wp_dequeue_script('prettyPhoto-init');
            wp_dequeue_script('jquery-blockui');
            wp_dequeue_script('jquery-placeholder');
            wp_dequeue_script('fancybox');
            wp_dequeue_script('jqueryui');
        }
    }
}
 function woo_columns_body_class($classes)
 {
     if (is_woocommerce()) {
         $classes[] = 'columns-' . as_option('woo_listing_column_number');
     }
     return $classes;
 }
Beispiel #6
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_woocommerce()) {
             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');
 }
/**
 * Get main menu style
 * @return type
 */
function ts_get_main_menu_style()
{
    $control_panel = ot_get_option('control_panel');
    if (ts_check_if_use_control_panel_cookies() && isset($_COOKIE['theme_main_menu_style']) && !empty($_COOKIE['theme_main_menu_style']) && ($control_panel == 'enabled_admin' && current_user_can('manage_options') || $control_panel == 'enabled_all')) {
        return $_COOKIE['theme_main_menu_style'];
    } else {
        if (isset($_GET['switch_main_menu_style']) && !empty($_GET['switch_main_menu_style'])) {
            return $_GET['switch_main_menu_style'];
        }
    }
    //get main menu style for specified page
    $main_menu_style = '';
    if (is_page()) {
        $main_menu_style = get_post_meta(get_the_ID(), 'main_menu_style', true);
    }
    if (!empty($main_menu_style) && $main_menu_style != 'default') {
        return $main_menu_style;
    } else {
        if (function_exists('is_woocommerce') && is_woocommerce()) {
            return ot_get_option('shop_menu_style');
        } else {
            return ot_get_option('main_menu_style');
        }
    }
}
Beispiel #8
0
function ing_woo_content_end()
{
    if (is_woocommerce()) {
        do_action("ing_content_close");
        echo "<!-- this is an addition -->";
    }
}
/**
 * For some reason products in the loop don't get the right context by default.
 * @param $post
 */
function hwoo_set_product($post)
{
    global $post, $product;
    if (is_woocommerce()) {
        $product = wc_get_product($post->ID);
    }
}
Beispiel #10
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;
     }
 }
Beispiel #11
0
function woodrobe_body_class($classes)
{
    if (is_woocommerce() || is_cart() || is_checkout() || is_account_page()) {
        $classes[] = 'woodrobe';
    }
    return $classes;
}
/**
 * Display logo base on page settings.
 */
function wpcharming_logo_render()
{
    global $post;
    global $woocommerce;
    $post_types = get_post_types('', 'names');
    $transparent_header_meta = null;
    $header_style = wpcharming_option('header_style');
    if ($woocommerce && is_woocommerce()) {
        $transparent_header_meta = get_post_meta(woocommerce_get_page_id('shop'), '_wpc_transparent_header', true);
    } else {
        foreach ($post_types as $post_type) {
            if (is_singular($post_type)) {
                global $post;
                $transparent_header_meta = get_post_meta($post->ID, '_wpc_transparent_header', true);
            }
        }
    }
    if ($transparent_header_meta == 'on' && $header_style == 'header-default') {
        if (isset($_REQUEST['header-demo'])) {
            $logo_url = wpcharming_option('site_logo', false, 'url');
        } else {
            $logo_url = wpcharming_option('site_transparent_logo', false, 'url');
        }
    } else {
        $logo_url = wpcharming_option('site_logo', false, 'url');
    }
    return $logo_url;
}
Beispiel #13
0
 function query_parsed_init()
 {
     global $gantry, $woocommerce;
     if (is_woocommerce()) {
         remove_filter('template_include', array($woocommerce, 'template_loader'));
         add_filter('gantry_mainbody_include', array('GantryGizmoWooCommerce', 'include_woocommerce_template'));
     }
 }
Beispiel #14
0
/**
 * Hooking WooCommerce.
 */
function simple_life_hooking_woo()
{
    remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
    if (is_woocommerce() && true === simple_life_get_option('enable_breadcrumb')) {
        add_action('simple_life_action_after_header', 'woocommerce_breadcrumb');
        remove_action('simple_life_action_after_header', 'simple_life_add_breadcrumb');
    }
}
Beispiel #15
0
/**
 * Enqueue scripts and styles for front-end.
 *
 */
function tabbysplace_scripts_styles()
{
    global $wp_styles;
    /*
     * Adds JavaScript to pages with the comment form to support
     * sites with threaded comments (when in use).
     */
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    //Loads Javascripts
    $tabby_param = array('ajax_url' => admin_url('admin-ajax.php'));
    wp_localize_script('jquery', 'tabby_param', $tabby_param);
    if (is_page_template('page-templates/news-archives.php')) {
        wp_enqueue_style('tabbysplace-owlcss', get_template_directory_uri() . '/css/owl.carousel.css', array(), '');
        wp_enqueue_script('tabbysplace-owl', get_template_directory_uri() . '/js/owl.carousel.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-tabby-news-archives', get_template_directory_uri() . '/js/tabby-news-archives.js', array('jquery'), '', true);
    }
    if (is_front_page()) {
        wp_enqueue_script('tabbysplace-home', get_template_directory_uri() . '/js/tabbysplace-home.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-bxsliderJs', get_template_directory_uri() . '/js/bxslider.js', array('jquery'), '', true);
        wp_enqueue_style('tabbysplace-bxslidercss', get_template_directory_uri() . '/css/bxslider.css', array(), '');
    }
    wp_enqueue_script('tabbysplace-placeholder', get_template_directory_uri() . '/js/jquery.placeholder.min.js', array('jquery'), '', true);
    wp_enqueue_script('tabbysplace-css-browser-selector', get_template_directory_uri() . '/js/css_browser_selector.js', array('jquery'), '', true);
    wp_enqueue_script('tabbysplace-modernizr', get_template_directory_uri() . '/js/modernizr.min.js', array('jquery'), '', true);
    wp_enqueue_script('tabbysplace-equalheight', get_template_directory_uri() . '/js/jquery.equalheight.js', array('jquery'), '', true);
    wp_enqueue_script('tabbysplace-menu', get_template_directory_uri() . '/js/menu.js', array('jquery'), '', true);
    wp_enqueue_script('tabbysplace-generaljs', get_template_directory_uri() . '/js/general.js', array('jquery'), '', true);
    //	if (is_page_template('page-templates/contact.php')) {
    if (!is_woocommerce()) {
        wp_enqueue_style('tabbysplace-selectbox-css', get_template_directory_uri() . '/css/jquery.selectbox.css', array(), '');
        wp_enqueue_script('tabbysplace-selectbox-js', get_template_directory_uri() . '/js/jquery.selectbox-0.2.js', array('jquery'), '', true);
    }
    if (is_page_template('page-templates/virtual-tour.php') || is_singular('virtual-tour')) {
        wp_enqueue_style('tabbysplace-owlcss', get_template_directory_uri() . '/css/owl.carousel.css', array(), '');
        wp_enqueue_style('tabbysplace-magnific-popupcss', get_template_directory_uri() . '/css/magnific-popup.css', array(), '');
        wp_enqueue_script('tabbysplace-magnific-popupjs', get_template_directory_uri() . '/js/magnific-popup.min.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-owl', get_template_directory_uri() . '/js/owl.carousel.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-imagemapster', get_template_directory_uri() . '/js/jquery.imagemapster.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-virtual-tour', get_template_directory_uri() . '/js/tabbysplace-virtual-tour.js', array('jquery'), '', true);
        $video_type = get_field('room_video_type', get_the_ID());
        $video_id = get_field('room_' . $video_type . '_video_id', get_the_ID());
        $tabby_tour_param = array('virtual_tour_map' => get_template_directory_uri() . '/images/map-lightbox.png', 'virtual_tour_map_filled' => get_template_directory_uri() . '/images/map-lightbox-filled.png', 'virtual_tour_smallmap_filled' => get_template_directory_uri() . '/images/small-map-filled.png', 'virtual_tour_current_mapid' => get_field('map_location_id', get_the_ID()), 'virtual_tour_video_type' => $video_type, 'virtual_tour_video_id' => $video_id);
        wp_localize_script('tabbysplace-virtual-tour', 'tabby_tour_param', $tabby_tour_param);
    }
    if (is_page_template('page-templates/adopt.php') || is_page_template('page-templates/sponsor.php')) {
        wp_enqueue_style('tabbysplace-owlcss', get_template_directory_uri() . '/css/owl.carousel.css', array(), '');
        wp_enqueue_script('tabbysplace-touchSwipe', get_template_directory_uri() . '/js/jquery.touchSwipe.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-owl', get_template_directory_uri() . '/js/owl.carousel.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-cat-listing', get_template_directory_uri() . '/js/tabbysplace-cat-listing.js', array('jquery'), '', true);
    }
    // Loads our main stylesheet.
    wp_enqueue_style('tabbysplace-style', get_stylesheet_uri());
    wp_enqueue_style('tabbysplace-responsive', get_template_directory_uri() . '/responsive.css', array('tabbysplace-style'), '');
    wp_enqueue_style('tabbysplace-virtual-tour', get_template_directory_uri() . '/virtual-tour.css', array('tabbysplace-style'), '');
    wp_enqueue_style('tabbysplace-fonts', get_template_directory_uri() . '/css/fonts.css', array('tabbysplace-style'), '');
}
function thb_breadcrumb()
{
    global $post, $wp_query;
    $id = $wp_query->get_queried_object_id();
    echo '<aside class="breadcrumb">';
    if (!is_front_page()) {
        echo '<a href="';
        echo home_url();
        echo '">' . __('Home', THB_THEME_NAME);
        echo "</a>";
    }
    if (is_singular('portfolio')) {
        $portfolio_main = get_post_meta($post->ID, 'portfolio_main', TRUE);
        if ($portfolio_main) {
            $portfolio_link = get_permalink($portfolio_main);
        } else {
            $portfolio_link = get_portfolio_page_link(get_the_ID());
        }
        echo '<span>/</span> <a href="' . $portfolio_link . '">' . __('Portfolio', THB_THEME_NAME) . '</a>';
        echo '<span>/</span>' . get_the_title();
    }
    if (is_home()) {
        echo '<span>/</span>' . __('Blog', THB_THEME_NAME);
    }
    if (is_page() && !is_front_page()) {
        $parents = array();
        $parent_id = $post->post_parent;
        while ($parent_id) {
            $page = get_page($parent_id);
            $parents[] = '<span>/</span><a href="' . get_permalink($page->ID) . '" title="' . get_the_title($page->ID) . '">' . get_the_title($page->ID) . '</a>';
            $parent_id = $page->post_parent;
        }
        $parents = array_reverse($parents);
        echo join(' ', $parents);
        echo '<span>/</span>' . get_the_title();
    }
    if (is_single() && !is_singular('portfolio')) {
        $categories = get_the_category();
        if ($categories) {
            foreach ($categories as $cat) {
                $cats[] = '<a href="' . get_category_link($cat->term_id) . '" title="' . $cat->name . '">' . $cat->name . '</a>';
            }
            echo '<span>/</span>' . join(', ', $cats);
        }
        echo '<span>/</span>' . ShortenText(get_the_title(), 40);
    }
    if (is_archive()) {
        if (class_exists('woocommerce') && is_woocommerce() && is_shop()) {
            echo '<span>/</span>' . get_the_title(wc_get_page_id('shop'));
        } else {
            echo '<span>/</span>' . thb_which_archive();
        }
    }
    if (is_search()) {
        echo '<span>/</span>' . thb_which_archive();
    }
    echo '</aside>';
}
function gmdl_add_mini_cart()
{
    global $woo_options;
    global $woocommerce;
    if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) && is_woocommerce()) {
        $mini_cart = '<a href="' . esc_url($woocommerce->cart->get_cart_url()) . '" class="mini-cart"><span>' . $woocommerce->cart->cart_contents_count . '</span></a>';
        echo $mini_cart;
    }
}
Beispiel #18
0
/**
 * Adds custom classes to the array of body classes.
 *
 * @param array $classes Classes for the body element.
 * @return array
 */
function wpcharming_body_classes($classes)
{
    global $woocommerce;
    global $post;
    if (is_page_template('template-fullwidth.php') || is_404()) {
        $classes[] = 'page-fullwidth';
    }
    // WooCommerce
    if ($woocommerce) {
        $woo_layout = get_post_meta(woocommerce_get_page_id('shop'), '_wpc_page_layout', true);
        if ($woo_layout == 'right-sidebar' || $woo_layout == 'left-sidebar') {
            $classes[] = 'shop-has-sidebar';
        }
    }
    // Boxed Layout
    if (wpcharming_option('site_boxed') || isset($_REQUEST['boxed_layout']) && ($_REQUEST['boxed_layout'] = 'enable')) {
        $classes[] = 'layout-boxed';
    }
    // Header Style
    if (wpcharming_option('header_style') || wpcharming_option('header_style') !== '') {
        if (isset($_REQUEST['header-demo'])) {
            $classes[] = 'header-' . $_REQUEST['header-demo'];
        } else {
            $classes[] = 'header-' . wpcharming_option('header_style');
        }
    } else {
        $classes[] = 'header-default';
    }
    // Fixed Header
    if (wpcharming_option('header_fixed')) {
        $classes[] = 'header-fixed-on';
    }
    // Transparent Header
    $post_types = get_post_types('', 'names');
    $header_style = wpcharming_option('header_style');
    $transparent_header_meta = null;
    if ($woocommerce && is_woocommerce()) {
        $transparent_header_meta = get_post_meta(woocommerce_get_page_id('shop'), '_wpc_transparent_header', true);
    } else {
        foreach ($post_types as $post_type) {
            if (is_singular($post_type)) {
                global $post;
                $transparent_header_meta = get_post_meta($post->ID, '_wpc_transparent_header', true);
            }
        }
    }
    if ($transparent_header_meta == 'on' && $header_style == 'header-default') {
        if (isset($_REQUEST['header-demo'])) {
            $classes[] = 'header-normal';
        } else {
            $classes[] = 'header-transparent';
        }
    } else {
        $classes[] = 'header-normal';
    }
    return $classes;
}
Beispiel #19
0
function siteorigin_north_woocommerce_enqueue_scripts()
{
    if (!function_exists('is_woocommerce')) {
        return;
    }
    if (is_woocommerce()) {
        wp_enqueue_script('siteorigin-north-woocommerce', get_template_directory_uri() . '/js/woocommerce.js', array('jquery'), SITEORIGIN_THEME_VERSION);
    }
}
Beispiel #20
0
function kt_wc_print_notices()
{
    if (class_exists('woocommerce')) {
        if (!is_shop() and !is_woocommerce() and !is_cart() and !is_checkout() and !is_account_page()) {
            echo '<div class="container">';
            echo do_shortcode('[woocommerce_messages]');
            echo '</div>';
        }
    }
}
 /**
  * Enqueue WooCommerce scripts.
  */
 function siteorigin_north_woocommerce_enqueue_scripts()
 {
     if (!function_exists('is_woocommerce')) {
         return;
     }
     if (is_woocommerce()) {
         wp_enqueue_script('siteorigin-north-woocommerce', get_template_directory_uri() . '/js/woocommerce.js', array('jquery'), SITEORIGIN_THEME_VERSION);
         wp_localize_script('siteorigin-north-woocommerce', 'so_ajax', array('ajaxurl' => admin_url('admin-ajax.php')));
     }
 }
Beispiel #22
0
 function woocommerce_get_sidebar()
 {
     global $woo_options;
     if (!is_woocommerce()) {
         get_sidebar();
     } elseif ($woo_options['woo_shop_archives_fullwidth'] == "false" && is_woocommerce() || is_product()) {
         get_sidebar();
     } elseif ($woo_options['woo_shop_archives_fullwidth'] == "true" && is_archive(array('product'))) {
         // no sidebar
     }
 }
Beispiel #23
0
function tokopress_wc_add_class($classes)
{
    if (is_woocommerce() && !is_product()) {
        $get_column = of_get_option('tokopress_wc_products_column_per_row');
        $classes[] = 'woocommerce-products-col-' . $get_column;
    }
    // if(!is_woocommerce()){
    // 	$classes[] = 'woocommerce';
    // }
    return $classes;
}
 function thb_woocommerce_scripts()
 {
     if (is_woocommerce() && is_product()) {
         wp_enqueue_script('easyzoom');
         wp_enqueue_script('sharrre');
     }
     wp_dequeue_script('prettyPhoto');
     wp_dequeue_script('prettyPhoto-init');
     wp_dequeue_script('jquery-blockui');
     wp_dequeue_script('jquery-placeholder');
     wp_dequeue_script('fancybox');
 }
 public static function add_scripts()
 {
     $suffix = SCRIPT_DEBUG && current_user_can('manage_options') ? "" : ".min";
     // handles the variation selection of products, is replaced by add-to-cart-variation-with-radio
     wp_deregister_script("wc-add-to-cart-variation");
     if (function_exists("is_woocommerce")) {
         if (is_woocommerce() && is_product()) {
             // Add the plugin script
             wp_enqueue_script("woocommerce-variations-with-radio-buttons-frontend", plugins_url("/assets/js/main" . $suffix . ".js", plugin_basename(__FILE__)), array("jquery", "woocommerce"), "1.0.1", true);
         }
     }
 }
function cuttz_woo_pages_customization()
{
    if (is_product() || is_checkout() || is_account_page()) {
        add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content');
    }
    // Disable the custom widget areas on certain pages
    if (is_woocommerce() || is_cart() || is_checkout() || is_account_page()) {
        remove_action('genesis_before_header', 'cuttz_sidebar_before_header');
        remove_action('genesis_after_header', 'cuttz_sidebar_after_header');
        remove_action('genesis_before_footer', 'cuttz_sidebar_above_footer', 5);
    }
}
Beispiel #27
0
function optimizer_is_woocommerce_page()
{
    if (function_exists("is_woocommerce") && is_woocommerce()) {
        return true;
    }
    $woocommerce_keys = array("woocommerce_shop_page_id", "woocommerce_terms_page_id", "woocommerce_cart_page_id", "woocommerce_checkout_page_id", "woocommerce_pay_page_id", "woocommerce_thanks_page_id", "woocommerce_myaccount_page_id", "woocommerce_edit_address_page_id", "woocommerce_view_order_page_id", "woocommerce_change_password_page_id", "woocommerce_logout_page_id", "woocommerce_lost_password_page_id");
    foreach ($woocommerce_keys as $wc_page_id) {
        if (get_the_ID() == get_option($wc_page_id, 0)) {
            return true;
        }
    }
    return false;
}
Beispiel #28
0
/**
 * Check if woocommerce.
 *
 * @param  array $only
 * @return bool
 */
function is_woo($only = array())
{
    if (function_exists('is_woocommerce') && is_woocommerce()) {
        return true;
    }
    $pages = array('woocommerce_shop_page_id', 'woocommerce_terms_page_id', 'woocommerce_cart_page_id', 'woocommerce_checkout_page_id', 'woocommerce_pay_page_id', 'woocommerce_thanks_page_id', 'woocommerce_myaccount_page_id', 'woocommerce_edit_address_page_id', 'woocommerce_view_order_page_id', 'woocommerce_change_password_page_id', 'woocommerce_logout_page_id', 'woocommerce_lost_password_page_id');
    foreach (array_intersect($pages, $only) as $page) {
        if (get_the_ID() == get_option($page, 0)) {
            return true;
        }
    }
    return false;
}
 /**
  * Conditional check:
  * Figure out if WooCommerce is installed.
  * If WooCommerce is installed, then check that we're on a Woo template.
  *
  * @return  bool
  */
 public static function is_woo()
 {
     /**
      * Check if WooCommerce is installed.
      * If not, then return false
      */
     if (!function_exists('is_woocommerce')) {
         return false;
     }
     /**
      * Return the result of the is_woocommerce() function (boolean)
      */
     return is_woocommerce();
 }
/**
 * Add breadcrumbs functionality to your WordPress theme
 *
 * Once you have included the function in your functions.php file
 * you can then place the following anywhere in your theme templates
 * if(function_exists('bootstrap_breadcrumbs')) bootstrap_breadcrumbs();
 *
 * credit to: c.bavota - http://bavotasan.com (thanks for the code start)
 */
function bootstrap_breadcrumbs()
{
    echo '<ol class="breadcrumb">';
    echo '<li><a href="' . home_url('/') . '">Home</a></li>';
    // are we at "blog home"?
    if (is_home()) {
        echo '<li><a href="#">Blogs</a></li>';
    }
    // where else do we want breadcrumbs
    if (!is_page_template('pt-home.php') && !is_home()) {
        // check if we're in a commerce plugin
        if (function_exists('is_woocommerce') && is_woocommerce()) {
            echo '<li><a href="/publications/order/">Shop</a></li>';
            $product_cats = wp_get_post_terms(get_the_ID(), 'product_cat');
            echo '<li><a href="/publications/order/' . str_replace(" ", "-", $product_cats[0]->name) . '">' . $product_cats[0]->name . '</a></li>';
        }
        // breadcrumb wordpress structures
        if (is_category() || is_single() || is_single('aof')) {
            if (get_the_category()) {
                $category = get_the_category();
                echo '<li><a href="/blog/category/' . str_replace(" ", "-", $category[0]->cat_name) . '">' . $category[0]->cat_name . '</a></li>';
            }
            if (is_single()) {
                echo '<li class="active">';
                the_title();
                echo '</li>';
            }
        } elseif (is_page()) {
            echo '<li class="active">';
            the_title();
            echo '</li>';
        }
    }
    echo '</ol>';
}