Query Post Type Category in WordPress
-
Hi there,
I have a wordpress website which I need the code/query which all allow me to display all other posts that belong to the category of the current post type that is being viewed.Eg;
Custom Post Type: Accommodation
Taxonomy: apartmentcat
Category: Chevron RenaissanceSo If I were on a page for Apartment 101 from the Chevron Renaissance, I would also be able to see a list of the other apartments in the Chevron Renaissance.
As there are new Categories added all the time, therefore I cannot hard code this query such as;
<?php query_posts(‘post_type=accommodation&apartmentcat=chevron-renaissance&showposts=20&orderby=menu_order’); ?>This works, however it would then require separate templates per category which is not what I want. I need a code that will allow one template to work from all Categories and show the posts related to the current posts category that is being viewed.
I have posted 2 other posts on this and had no reply and am desperate for the answer. Any help at all is appreciated.
- The topic ‘Query Post Type Category in WordPress’ is closed to new replies.