Skip Navigation

[Gelöst] Custom post taxonomy archive not working

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

Problem:

Display the archive page title in a term's archive page.

Solution:
you can try the Views shortcode:

[wpv-archive-title]

Relevant Documentation:

https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-archive-title

This support ticket is created vor 5 Jahre, 1 Monat. 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 6 Antworten, has 2 Stimmen.

Last updated by guyA-2 vor 5 Jahre, 1 Monat.

Assisted by: Luo Yang.

Author
Artikel
#1205575

Hey there,

We have a custom post type called case studies.
You can see this working here:
hidden link

It has a taxonomy called packages.
We are inserting a view called (Case Studies Packages Taxonomy View) into our php template called taxonomy-package.php
I've tried creating a wordpress archive in Toolset but I can't get this to work.

You can see the front-end of the taxonomy archive looks ok:
hidden link

But the h2 sub-heading which is using [wpv-taxonomy-title] which should display the taxonomy title of whichever taxonomy we're in - but this is stuck on the first taxonomy item 'Blog Package' no matter which taxonomy archive you switch too.

It says:
Here are the case studies for our Blog Package

It should say:
Here are the case studies for our Consulting Work

Also the main content is repeated 9 times.

And on taxonomy archives like:
hidden link
There is no content but it's still looping through 9 times and displaying empty boxes when it should show 'No items found'.

#1205951

Hello,

Thanks for the details, I can login into your website.

Q1) Here are the case studies for our Blog Package

Since it is in a term's archive page, and you are going to display the archive page title, you can try the shortcode: [wpv-archive-title].

For example, edit the taxonomy view "Case Studies Packages Taxonomy View":
hidden link

in section "Loop Editor", replace the codes from:
<h2>Here are the case studies for our <span>[wpv-taxonomy-title]</span></h2>

To:
<h2>Here are the case studies for our <span>[wpv-archive-title]</span></h2>

Q2) Also the main content is repeated 9 times...

You are using Taxonomy view in the term's archive page, but the correct way is setup Views WordPress Archive, see our document:
https://toolset.com/documentation/user-guides/creating-wordpress-custom-post-archives/

Please follow above document to customize the taxonomy wordpress archive page, and test again

#1206217

Thanks for your support Luo,

I've now tried creating a WordPress archive in the normal way on the case studies archive.
hidden link But as you can see this doesn't work.

When I inspect the page the content is there but it looks like there's some conflict with the theme which is why I was embedding the view into the php templates in the first place.

Unfortunately we're unable to shut of the theme or switch our theme as we have over 200 blog posts that use this theme and the Tatsu page builder.

The case studies view embedded into the php template was working fine the only problem we have is getting the taxonomy-case-study.php to display properly.

Can you help us find a work-around using the taxonomy-case-study.php template for this?
Or is it not possible to display taxonomy views in a php template?

#1206699

The URL hidden link is archive page of post type "case-studies", but theme file "taxonomy-case-study.php" is for archive page of "case-study", why do you need to use taxonomy theme file to customize the archive page of post type?

See WordPress document.

And I have checked the URL:
hidden link

Views wordpress archive "Case Studies Archive" does work on above archive page, but there are some other CSS/JS codes setup it's outer DIV tag to 0 height, so it does not display correctly.

There is a simple workaround, you can use CSS codes to override it, for example, edit wordpress archive "Case Studies Archive":
hidden link

click "CSS editor", add below codes:

.portfolio-container{
height: auto !important; 
}

Test it again:
hidden link

Check if it is fixed or not.

#1208172

Thanks Luo,

That's got me moving forward again. I'm now using the Toolset WordPress archive as the archive for the case studies custom post type and taxonomy.

I'd like to display different content under the h1 heading using a conditional:
Is it possible to do something like this:
If case studies archive display:
Check out our case studies to see how we've helped our clients
If case studies taxonomy display:
Here are the case studies for our [wpv-archive-title]

I've been looking for the documentation on how to but don't know the syntax for this conditional.

Thanks for your support!

New threads created by Luo Yang and linked to this one are listed below:

https://toolset.com/de/forums/topic/display-different-content-under-the-h1-heading-using-a-conditional/

#1208176
#1208179

My issue is resolved now. Thank you!

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