Skip Navigation

[Resolved] Creating a view for category archive

This thread is resolved. Here is a description of the problem and solution.

Problem:

I want to display "Hotel" custom post type entries on a category archive page so that when viewing a category (e.g., location), it shows hotel posts assigned to that category.

Solution:

Enable the same taxonomy (e.g., Categories) for Hotels, then create a View listing Hotels filtered by "term set by the current archive page." Finally, insert this View into the Category archive template using Toolset WordPress Archives or its shortcode [wpv-view name="hotels-in-current-category"].

Relevant Documentation:

https://toolset.com/course-lesson/enabling-legacy-version-of-toolset-views/

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.

This topic contains 3 replies, has 1 voice.

Last updated by onwebdev 1 week, 5 days ago.

Assisted by: Christopher Amirian.

Author
Posts
#2817683

Hello,

I have a category (example - location), in the archive page of that category ( the categories are used both by posts and CPT , called hotels)

I want to display the posts of Hotel CPT, within the category archive template.

Would really appreciate help, with creating this view in toolset.

Thanks.

#2817812

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Welcome to Toolset support. Below is the quickest way to show Hotel posts on every category‑archive page, limited to the category being viewed.

1. Make sure Hotels use the same taxonomy

1. Toolset → Post Types → edit Hotel.
2. In Taxonomies to be used with this Post Type tick Categories (or the taxonomy you already use for locations).
3. Update.

2. Create a View that lists Hotels in “this” category

1. Toolset → Views → Add New View.
2. Name it Hotels in current category.
3. Choose Content → Post type = Hotel.
4. In Query Filter click Add a filter → Taxonomy → choose Categories →
Select items with taxonomy → Term set by the current archive page.
5. Design the Loop (title, excerpt, etc.) and Save.

This View now returns Hotel posts whose category term equals the category archive that’s being shown.

3. Insert the View into the category‑archive template

1. Toolset → WordPress Archives → edit the archive named Categories.
2. In the editor place your cursor where the Hotels list should appear.
3. Insert a View Block (or in legacy mode paste the shortcode):

[wpv-view name="hotels-in-current-category"]

4. Save/Update the archive template.

-----------

If you do not see the Toolset > Views menu, you need to enable the legacy mode:

- Go to "Toolset > Settings > General".
- Find the "Editing experience" section.
- Check the "Show both the legacy and Blocks interface and let me choose which to use for each item I build" checkbox.
- Reload the browser page.
- Go to the newly added "Toolset > Views" menu.
- There you will be able to edit the views.

For more information:
https://toolset.com/course-lesson/enabling-legacy-version-of-toolset-views/

Thanks.

#2817821

Thanks for your response. Yes i have solved this , during the weekend. But the biggest problem, is I had to forego a FSE theme, to make the site work with toolset. I liked that theme a lot. Toolset views block, archives do not seem to work with FSE themes.

For now, had to shift to one of the recommended themes, by Toolset.

Ardently hope, Toolset team is working on compatbility with FSE themes.

regards

#2817926

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Yes unfortunately, we do not have support for the FSE theme.

The problem is that those themes do not use PHP at all, and they all rely on JavaScript.

Toolset is a PHP platform, and it is nearly impossible to port such huge functionality to JS/REST API mode.

If there is a decision to go the route of supporting FSE themes, we will communicate that via email to all of our customers.

Thank you for your understanding.

#2817932

Thanks Mr. Amirian, for the help.