Th3 Canadian 3h
Supreme Member
- Jun 15, 2016
- 1,358
- 875
this is what it looks like
I need to add spaces between them and I can't figure it out for the life of me
This is the code in php, I know it's something simple
I need to add spaces between them and I can't figure it out for the life of me
This is the code in php, I know it's something simple
PHP:
function wwofCategoriesBeforeListing() {
$args = array(
'taxonomy' => 'product_cat',
'hierarchical' => true,
'hide_empty' => true
);
$all_categories = get_categories( $args );
if ($all_categories) {
foreach ($all_categories as $cat) {
echo '<a data-cat-slug="' . $cat->slug . '" class="wwofCatLink" href="'. get_term_link($cat->slug, 'product_cat') .'">'. $cat->name .'</a>';
}
echo' <script type="text/javascript">
jQuery(".wwofCatLink").click(function(e) {
e.preventDefault();
var catSlug = jQuery(this).data("cat-slug");
jQuery("select#wwof_product_search_category_filter").val(catSlug);
jQuery("input#wwof_product_search_form").val("");
jQuery("input#wwof_product_search_btn").trigger("click");
});
</script>';
}
}
add_action('wwof_action_before_product_listing', 'wwofCategoriesBeforeListing', 10);