| <?php
// Create a new widget area called Product Category filter
add_action( 'widgets_init', 'product_filter_widget_area' );
function product_filter_widget_area() {
register_sidebar( array(
'id' => 'product_filter_sort',
'name' => __( 'Product filter widgets', 'rentattire' ),
'description' => __( 'Here goes your filter items', 'rentattire' ),
'before_widget' => '<div class="product-category-dropdown">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
) );
}
// Add this widget area on top of the category and shop pages
add_action( 'woocommerce_before_shop_loop','add_widget_area' ); // Hook it after headline and before loop
function add_widget_area() {
if ( is_active_sidebar( 'product_filter_sort' ) ) {
dynamic_sidebar( 'product_filter_sort' );
}
} |
Comments
Post a Comment