Reputation: 807
I have a custom post type clientgallery
and the custom taxonomy client
.
To get all galleries I can type website.com/clientgallery.
But I want to show only galleries of a specific client, like: website.com/clientgallery/miller
So, miller
should act like a get parameter.
I already know how to get the galleries by client, but I don't know how to get the parameter part working.
$args = array(
'numberposts' => -1, //limit the number of posts, set 0 if no limit required.
'orderby' => 'post_date', //order by post_date field.
'order' => 'DESC', //order by descending oder.
'post_type' => 'clientgallery', //the post type is custom post type 'News & Events'
'post_status' => 'publish', //post status is 'publish'
'tax_query' => array(
array(
'taxonomy' => 'client', //custom taxonomy slug
'field' => 'slug', //select taxonomy term by slug
'terms' => $_GET['client'] //taxonomy term is called 'home-page'
)
));
Upvotes: 0
Views: 947
Reputation: 2249
Call it taxonomy-client.php : See all info here on template hierarchy for WordPress : http://codex.wordpress.org/images/1/18/Template_Hierarchy.png
Upvotes: 2
Reputation: 2249
If your taxonomy client is only associated with the clientgallery post type, then website.com/client/miller should suffice to show your list of clientgalleries for this client. I tested it on my site, it works. Or am I getting something wrong?
Upvotes: 1