0

I have two post types "restaurant" & "pub", they both share same custom taxonomy "country". And I display each post type in archive page.

What I want to do is, when I visit "restaurant" archive page, there is the taxonomy "country" terms listed as the menu in that page. The terms has to be from the posts that created in "restaurant" post type, so when user click on the terms (let say "US"), it will display the posts from "restaurant" that in "US".

Here is the illustration: enter image description here

Thanks

1 Answer 1

1

Displaying two different menus base on the archive is no problem using is_post_type_archive()

What you are looking for is essentially the link to an term archive that only contains posts of a certain post type. Something like /index.php?term=US&post_type=pub. As far as I'm aware of WordPress doesn't offer this natively.

You will have to create your own page template and rewrite rules to make it display like /restaurants/fr. I think this questions covers enough about that: How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy

1
  • It works, but it shows these error: Notice: Undefined property: stdClass::$labels in /wp-includes/general-template.php on line 665 Notice: Trying to get property of non-object in /wp-includes/general-template.php on line 665
    – dev-jim
    Aug 1, 2012 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.