Created
October 1, 2017 07:19
-
-
Save neilgee/7a4dc9590bce058285b7f7c2b6e0e9d4 to your computer and use it in GitHub Desktop.
WooCommerce Product Category Dropdown in Archive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // <~ don't add me in | |
add_action( 'widgets_init', 'wb_extra_widgets' ); | |
/** | |
* Register new Widget area for Product Cat sort dropdown. | |
*/ | |
function wb_extra_widgets() { | |
register_sidebar( array( | |
'id' => 'prod_sort', | |
'name' => __( 'Product Cat Sort', 'themename' ), | |
'description' => __( 'This site below Shop Title', 'themename' ), | |
'before_widget' => '<div>', | |
'after_widget' => '</div>', | |
'before_title' => '<h3 class="widgettitle">', | |
'after_title' => '</h3>' | |
) ); | |
} | |
add_action( 'woocommerce_before_shop_loop','wb_prod_sort' ); // Hook it after headline and before loop | |
/** | |
* Position the Product Category Sort dropdown. | |
*/ | |
function wb_prod_sort() { | |
if ( is_active_sidebar( 'prod_sort' ) ) { | |
dynamic_sidebar( 'prod_sort' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment