In my flexible content group, I have a layout (vendors) in order to display a list on the front end.
In my script, I’m currently using the following query:
query_posts(array(
‘post_type’ => ‘vendors’,
‘numberposts’ => 100,
‘posts_per_page’ => 100,
‘orderby’ => ‘menu_order’,
‘order’ => ‘ASC’,
‘post__not_in’ => array(
get_the_ID()
),
));
I’m wanting to add the functionality to filter the list based on categories using the “taxonomy” field type, so I added a field to the layout (“categories”).
If I hard code this to the query:
‘category__and’ => array(5),
it will display only those vendors assigned to the category id 5.
What I want is to be able to assign the categories based on the selection in the flexible content. I figured something like this would work:
first
category__and’ => array(get_sub_field(‘categories’)),
but it does not. How can I fix this?
Appreciate the help.
(not an expert in PHP, obviously, so please go easy! Thx)