Example #1
0
<?php

/**
 * The sidebar containing the alternate widget area.
 *
 * @link https://developer.wordpress.org/themes/template-files-section/partial-and-miscellaneous-template-files/#sidebar-php
 *
 * @package Rock
 * @since   1.0.0
 */
if (!rock_layout_has_sidebar() || !is_active_sidebar('sidebar-2') || 0 === strpos(rock_get_layout(), 'three-column-')) {
    return;
}
?>

<div id="tertiary" class="widget-area" role="complementary">

	<?php 
dynamic_sidebar('sidebar-2');
?>

</div><!-- #tertiary -->
Example #2
0
/**
 * Sets the content width in pixels, based on the theme layout.
 *
 * Priority 0 to make it available to lower priority callbacks.
 *
 * @action after_setup_theme
 * @global int $content_width
 * @since  1.0.0
 */
function rock_content_width()
{
    $layout = rock_get_layout();
    $content_width = 'one-column-wide' === $layout ? 1068 : 688;
    /**
     * Filter the content width in pixels.
     *
     * @since 1.0.0
     *
     * @param string $layout
     *
     * @var int
     */
    $GLOBALS['content_width'] = (int) apply_filters('rock_content_width', $content_width, $layout);
}
Example #3
0
/**
 * Filter the number of WooCommerce shop columns
 *
 * @filter loop_shop_columns
 * @filter woocommerce_related_products_columns
 * @filter woocommerce_upsells_products_columns
 * @since 1.0.0
 *
 * @param  int $columns
 *
 * @return int
 */
function rock_wc_shop_columns($columns)
{
    global $post;
    $page_id = is_shop() ? wc_get_page_id('shop') : $post->ID;
    if (0 === strpos(rock_get_layout(absint($page_id)), 'three-column-')) {
        add_filter('post_class', 'rock_wc_product_classes');
        $columns = 2;
    }
    return $columns;
}
Example #4
0
/**
 * Check if the current layout has a sidebar.
 *
 * @since 1.0.0
 *
 * @param  string $layout (optional)
 *
 * @return bool
 */
function rock_layout_has_sidebar($layout = null)
{
    $layout = $layout ? $layout : rock_get_layout();
    $has_sidebar = !in_array($layout, array('one-column-wide', 'one-column-narrow'));
    /**
     * Filter if the current layout has a sidebar.
     *
     * @since 1.0.0
     *
     * @param string $layout
     *
     * @var bool
     */
    return (bool) apply_filters('rock_layout_has_sidebar', $has_sidebar, $layout);
}