Query custom taxonomy posts
-
Hi all,
I’m building a website that has a portfolio full of project references, using the custom post type “clients”.
Using a “type-clients.php” template file and following code I’m able to show all these clients and have them refer to their respective single post version using a “single-client.php”.
<?php query_posts('posts_per_page=50&post_type=clients'); ?>
Works like a charm. For these clients however, I have provided a range of “services” as a custom taxonomy, used to display which services were used for a specific client. I managed to list the services for a client using the following code, which actually shows the selected services for that client and makes them clickable.
`<?php echo cc_get_the_term_list($post->ID, ‘services’, ‘ ‘, ‘, ‘, ”, 0); ?>’
When a link for such a service is clicked, I would like to show all other clients that used this service. If I click the link, the page mysite.com/services/selected-service is loaded using my “taxonomy-services.php” template, but it shows ALL clients instead of only those for the “selected-service”.
What query do I need to put in my template to make sure only the clients that belong to a certain service are shown? I want to do the same as with old-fashioned categories, so that site.com/category-name only shows posts for that specific category in the url.
Thanks in advance for any help.
- The topic ‘Query custom taxonomy posts’ is closed to new replies.