Beispiel #1
0
/**
 * Get Bootstrap column classes for content area
 *
 * @since  1.0
 *
 * @return array Array of classes
 */
function bigboom_get_content_columns($layout = null)
{
    $layout = $layout ? $layout : bigboom_get_layout();
    if ('full-content' == $layout) {
        return array('col-md-12');
    }
    return array('col-md-9', 'col-sm-9', 'col-xs-12');
}
Beispiel #2
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;
}
Beispiel #3
0
 /**
  * Hooks to WooCommerce actions, filters
  *
  * @since  1.0
  * @return void
  */
 function hooks()
 {
     $this->layout = bigboom_get_layout();
     $this->new_duration = bigboom_theme_option('product_newness');
     $this->shop_view = isset($_COOKIE['shop_view']) ? $_COOKIE['shop_view'] : 'grid';
     // WooCommerce Styles
     add_filter('woocommerce_enqueue_styles', array($this, 'wc_styles'));
     // Add toolbars for shop page
     add_filter('woocommerce_show_page_title', '__return_false');
     remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20);
     remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30);
     remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination');
     add_action('woocommerce_before_shop_loop', array($this, 'shop_tool_bar'));
     add_action('woocommerce_after_shop_loop', array($this, 'shop_tool_bar'));
     // Change shop columns
     add_filter('loop_shop_columns', array($this, 'shop_columns'), 20);
     // Add Bootstrap classes
     add_filter('post_class', array($this, 'product_class'), 10, 3);
     // Wrap product loop content
     add_action('woocommerce_before_shop_loop_item', array($this, 'open_product_inner'), 1);
     add_action('woocommerce_after_shop_loop_item', array($this, 'close_product_inner'), 100);
     // Add badges
     remove_action('woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash');
     remove_action('woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash');
     add_action('woocommerce_before_shop_loop_item_title', array($this, 'product_badges'));
     add_action('woocommerce_before_single_product_summary', array($this, 'product_badges'));
     // Add secondary image to product thumbnail
     remove_action('woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail');
     add_action('woocommerce_before_shop_loop_item_title', array($this, 'product_thumbnail'));
     // Display product excerpt and subcategory description for list view
     add_action('woocommerce_after_shop_loop_item', 'woocommerce_template_single_excerpt', 5);
     add_action('woocommerce_after_subcategory', array($this, 'show_cat_desc'));
     // Change number of related products
     add_filter('woocommerce_output_related_products_args', array($this, 'related_products_args'));
     add_filter('woocommerce_cross_sells_columns', array($this, 'cross_sells_columns'));
     // Change columns number of product thumbnails in the single product page
     add_filter('woocommerce_product_thumbnails_columns', array($this, 'product_thumbnails_columns'));
     // Add a sep line before buttons
     add_action('woocommerce_after_shop_loop_item', array($this, 'add_sep_line'), 5);
     // Add the wishlist button and compare button
     add_action('woocommerce_after_shop_loop_item', array($this, 'product_loop_wishlist'), 15);
     add_action('woocommerce_after_shop_loop_item', array($this, 'product_loop_compare'), 20);
     // Show share icons
     add_action('woocommerce_single_product_summary', array($this, 'share'), 35);
     // Change next and prev icon
     add_filter('woocommerce_pagination_args', array($this, 'pagination_args'));
     // Change product image thumbnail html
     add_filter('woocommerce_single_product_image_thumbnail_html', array($this, 'product_single_thumbnail_html'), 10, 4);
     // Change product image html
     add_filter('woocommerce_single_product_image_html', array($this, 'product_single_html'));
     // Show view detail after view cart button
     add_action('woocommerce_after_add_to_cart_button', array($this, 'view_detail_button'));
     // Change product rating html
     add_filter('woocommerce_product_get_rating_html', array($this, 'product_rating_html'), 10, 2);
     // Show sale price date
     add_action('woocommerce_after_shop_loop_item', array($this, 'sale_price_date'), 15);
     // Change product stock html
     add_filter('woocommerce_stock_html', array($this, 'product_stock_html'), 10, 3);
     // Change add to cart link
     add_filter('woocommerce_loop_add_to_cart_link', array($this, 'add_to_cart_link'));
     // Add products upsell display
     remove_action('woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15);
     add_action('woocommerce_after_single_product_summary', array($this, 'product_upsell_display'), 15);
 }
Beispiel #4
0
<?php

/**
 * The Sidebar containing the main widget areas.
 *
 * @package BigBoom
 */
if ('full-content' == bigboom_get_layout()) {
    return;
}
$sidebar = 'blog-sidebar';
if (is_page()) {
    $sidebar = 'page-sidebar';
} elseif (function_exists('is_woocommerce') && is_woocommerce()) {
    $sidebar = 'shop-sidebar';
}
?>
<aside id="primary-sidebar" class="widget-area primary-sidebar <?php 
echo esc_attr($sidebar);
?>
 col-xs-12 col-sm-3 col-md-3" role="complementary">
	<?php 
dynamic_sidebar($sidebar);
?>
</aside><!-- #secondary -->
Beispiel #5
0
/**
 * Show entry thumbnail base on its format
 *
 * @since  1.0
 */
function bigboom_entry_thumbnail($size = 'blog-thumb')
{
    $html = '';
    $css_class = '';
    if ('full-content' == bigboom_get_layout()) {
        $size = 'blog-large-thumb';
    }
    $size = apply_filters('bigboom_post_format_thumbnail_size', $size);
    switch (get_post_format()) {
        case 'image':
            $image = bigboom_get_image(array('size' => $size, 'format' => 'src', 'meta_key' => 'image', 'echo' => false));
            if (!$image) {
                break;
            }
            $html = sprintf('<a class="entry-image" href="%1$s" title="%2$s"><img src="%3$s" alt="%2$s"></a>', esc_url(get_permalink()), the_title_attribute('echo=0'), esc_url($image));
            break;
        case 'gallery':
            $images = bigboom_get_meta('images', "type=image&size={$size}");
            if (empty($images)) {
                break;
            }
            $gallery = array();
            foreach ($images as $image) {
                $gallery[] = '<li>' . '<img src="' . esc_url($image['url']) . '" alt="' . the_title_attribute('echo=0') . '">' . '</li>';
            }
            $html .= '<div class="flexslider entry-image"><ul class="slides">' . implode('', $gallery) . '</ul></div>';
            break;
        case 'audio':
            $audio = bigboom_get_meta('audio');
            if (!$audio) {
                break;
            }
            // If URL: show oEmbed HTML or jPlayer
            if (filter_var($audio, FILTER_VALIDATE_URL)) {
                // Try oEmbed first
                if ($oembed = @wp_oembed_get($audio)) {
                    $html .= $oembed;
                } else {
                    $html .= '<div class="audio-player">' . wp_audio_shortcode(array('src' => $audio)) . '</div>';
                }
            } else {
                $html .= $audio;
            }
            break;
        case 'video':
            $video = bigboom_get_meta('video');
            if (!$video) {
                break;
            }
            // If URL: show oEmbed HTML
            if (filter_var($video, FILTER_VALIDATE_URL)) {
                if ($oembed = @wp_oembed_get($video)) {
                    $html .= $oembed;
                } else {
                    $atts = array('src' => $video, 'width' => 848);
                    if (has_post_thumbnail()) {
                        $atts['poster'] = bigboom_get_image('format=src&echo=0&size=full');
                    }
                    $html .= wp_video_shortcode($atts);
                }
            } else {
                $html .= $video;
            }
            break;
        case 'link':
            if (!empty($thumb)) {
                $html .= '<a class="entry-image" href="' . esc_url(get_permalink()) . '">' . $thumb . '</a>';
            }
            $link = bigboom_get_meta('url');
            $text = bigboom_get_meta('url_text');
            if (!$link) {
                break;
            }
            $html .= sprintf('<a href="%s" class="link-block">%s</a>', esc_url($link), $text ? $text : $link);
            break;
        case 'quote':
            if (!empty($thumb)) {
                $html .= '<a class="entry-image" href="' . get_permalink() . '">' . $thumb . '</a>';
            }
            $quote = bigboom_get_meta('quote');
            $author = bigboom_get_meta('quote_author');
            $author_url = bigboom_get_meta('author_url');
            if (!$quote) {
                break;
            }
            $html .= sprintf('<blockquote>%s<cite>%s</cite></blockquote>', esc_html($quote), empty($author_url) ? $author : '<a href="' . esc_url($author_url) . '"> - ' . $author . '</a>');
            break;
        default:
            $thumb = bigboom_get_image(array('size' => $size, 'meta_key' => 'image', 'echo' => false));
            if (empty($thumb)) {
                break;
            }
            $html .= '<a class="entry-image" href="' . get_permalink() . '">' . $thumb . '</a>';
            break;
    }
    if ($html = apply_filters(__FUNCTION__, $html, get_post_format())) {
        echo "<div class='entry-format'>{$html}</div>";
    }
}