Skip Navigation

[Resolved] Can I use the same archive but have a method to only show one taxonomy type

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 5.45 hours from now. Thank you for your understanding.

This topic contains 2 replies, has 2 voices.

Last updated by johnH-29 7 months, 1 week ago.

Author
Posts
#2691618

Tell us what you are trying to do?
I want to have a single archive but be able to only display posts with a specific taxonomy type

Is there any documentation that you are following?
I have not seen specific up to date documentation

Is there a similar example that we can see?
I have a custom post of local-treat where I have local shops, eat and drink, places to stay. Some posts belong to more than one taxonomy type - e.g. a deli might also be a cafe. I only want one archive but I want to display it depending on a selection from a menu item so the user say selects places to eat and drink.
From what I have seen, it seems possible to build an archive specifying a taxonomy type but this seems over the top when the result will be the same other than the filter. I am hoping I have missed something very simple.

What is the link to your site?
haddington.info/index.php/local-treat
Thank you.

#2691733

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

I don't entirely follow what you are describing, let's try and clarify that.

First, though, I'd suggest you check your permalink settings, its quite unusual to have an archive URL like haddington.info/index.php/local-treat instead of just haddington.info/local-treat

There are two main kinds of archives, both of which display posts.

There is the post type archive, which displays posts of that type. So your /local-treat archive would display local-treat posts. You can filter which local-treat posts to include in the output, e.g. to only show local treats with specified categories.

The second kind are called taxonomy archives, and there you display posts which have assigned the term specified in the url, e.g. site.com/colour/red/ would list posts that have the red colour category. You can also filter which posts appear, but you can't filter by colour: red posts will always be shown at this URL, not blue or green, but you can filter by other taxonomies or fields.

It sounds like you want the first kind? And you want to include category filters to users can choose "places to eat", "places to stay", or whatever your categories are.

Check this link for a description of how to add filters to your archive: https://toolset.com/course-lesson/creating-a-custom-archive-page/#add-a-custom-search-to-an-archive

#2691763

Hi and thanks for responding. I want the results to be displayed for the user without their having to apply a filter. I believe this is the second option you have given (I have used the search option and category filters in other sections on the site)
I will go and look at permalink settings too to remove the index.php piece from the URL.

Do you have documentation for taxonomy archives - do I have to create different archive templates for each taxonomy term (I don't really want to do that as it is not easy to keep the archive templates in the same state once you start having to recreate them)

Thanks

#2691767

Hi. I have changed the permalink - thank you.

I also found that the url for seeing the specific taxonomy type is related to treat-type rather than local-treats - as follows:
hidden link

I didn't see that anywhere in the documentation and maybe it could help others?

Thanks