Skip Navigation

[Gelöst] Filtering CPT by taxonomy on archive page

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

Using Views WordPress Archive to customize the Therapies archive page, But all we have is the taxonomy titles repeated 4 times over, and no posts being displayed under these headings.

Solution:

You can edit the WordPress Archive, in section "Loop Editor", put the taxonomy view's shortcode outsider Views loop, for example:

https://toolset.com/forums/topic/filtering-cpt-by-taxonomy-on-archive-page/#post-1391995

Relevant Documentation:

This support ticket is created vor 4 Jahre, 5 Monate. There's a good chance that you are reading advice that it now obsolete.

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 Antworten, has 2 Stimmen.

Last updated by guyA-2 vor 4 Jahre, 5 Monate.

Assisted by: Luo Yang.

Author
Artikel
#1391387

Hi there

We have a CPT (custom post type) called Therapies, which has 4 taxonomies (Energy Healing, Massage, Natural Health, Talking Therapies). On an archive page we want to display the titles of these 4 taxonomies and underneath these titles, we want to display the post links of the therapies.

We've tried creating a parent taxonomy view that is dropped onto the archive page, and then embedding a child view filtering by the page where the view is shown. But all we have is the taxonomy titles repeated 4 times over, and no posts being displayed under these headings. You can see this here: hidden link

Can you help?
Thanks.

#1391995

Hello,

I assume you are using Views WordPress Archive to customize the Therapies archive page, please edit the WordPress Archive(ID 1328), in section "Loop Editor", put the taxonomy view's shortcode outsider Views loop, for example:

...
	[wpv-items-found]
[wpv-view name="your-taxonomy-view-slug"]
	<!-- wpv-loop-start -->
		<wpv-loop>
... here display post information ...
		</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
...
#1392221

Thanks, we're making progress. The taxonomy titles are no longer repeating as we've moved them outside the loop. However, the posts within the taxonomies are still not displaying.

We're using a child view called therapies-posts-view (ID 1332) and a parent view (therapies-taxonomy-view ID 1331) that we're dropping into the archive. Where are we going wrong?

Thanks for your support.

#1392911

I am not sure how do you setup the view ID 1332 and ID 1331, but the problem URL you mentioned above is archive page of post type "therapies", there is a known issue when you put a taxonomy view into WordPress archive: the content template in taxonomy view won't work as expected, see the errata here:
https://toolset.com/errata/views-shortcodes-return-empty-output-after-ajax-pagination-triggering-in-a-taxonomy-view/

The workaround for now:
avoid using a content template in the Views Loop editor and instead add your content directly in the Loop editor.

If you need more assistance for it, please provide a test site with the same problem, I need to debug it in a live website.

#1393087

Thanks for the details, I can log into your website and see the problem, I have done below modifications in your website,

Edit the post view
hidden link
in section "Query Filter", change the filter from:
Select posts whose parent is the page where the View is shown.

To:
Select posts with taxonomy:
Types of Therapies set by the parent Taxonomy View

Please test again, check if is fixed, thanks.

More help:
https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/

#1393129

Thanks for your help Luo. Our issue is resolved now. Have a great day/night!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.