I need to do a small modification on WP site done by someone else. And my WP experience is close to zero. But I'm comfortable with PHP.
Wordpress Version: 3.8
ONLY Advanced Custom Fields 4.3.4 [ACF] http://wordpress.org/plugins/advanced-custom-fields/
There's only one group Products made with ACF with fields like title, description, price, store. Site owner add Products with details & which stores they are available at.
currently the products are displayed correctly based on the url
will take to a list of product categories. When user clicks any of the category it will show the filtered products list with the ACF field store
All categories are displayed regardless of whether it contain products for the specific stores
ie., category 2 has only one product product 10 and it is only available in store1. But store2 & store3 shows category 2 even though it doesn't have any valid product.
Currently the following code is used to display categories.
$args = array( 'type' => 'post', 'child_of' => 0, 'parent' => '0', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 1, 'taxonomy' => 'category', ); $top_categories = get_categories($args);
I want $top_categories to return only those categories with products for current store