Tell us what you are trying to do?
I have created a taxonomy called "expertise" that is used with two custom post types, "consultants" and "case studies".
On the case study Layout I have included the list of taxonomies for that case study. These display ok.
However, I want to change the links behind those taxonomies so that they link to the consultants archives, filtered by the selected taxonomy.
Is there any documentation that you are following?
https://toolset.com/forums/topic/custom-archive-for-posts-and-show-title/
https://toolset.com/forums/topic/setup-and-display-dynamic-deeplinks-in-a-catalog-site/
Is there a similar example that we can see?
No.
What is the link to your site?
Currently localhost only.
The Link will lead to the Taxonomy Archive Page natively, when you insert the ShortCode for Toolset Taxonomies.
That Archive can include only all Posts Types attached to the taxonomy (only selected ones only with native Taxonomies)
This means the archive will return both post types, in any case.
You could check in the Loop with HTML conditional what the post type displayed is and remove it if it's the wrong type:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
Now, as for the link to this Archive, you can use the Link you get by inserting with [wpv-post-taxonomy type="toolset-custom-taxonomy"].
This already leads to the archive as hidden link
In your case, this should solve the issue, since you can hide the unwanted post information with Conditional HTML in the Loop.
Otherwise, I suggest to redirect to a Page, passing along URL parameters that then are accepted by a Post View (not archive) that has a query filter for the Taxonomy, and queries the desired Post Type only.
Hi Beda. Thanks for your help.
In the Layout for a single Case Study, I've included the link to the taxonomy archive ok using [wpv-post-taxonomy type="consultant-expertise"]
This produces links that are of the format localhost/site1/consultant-expertise/skill1/
I have created a Layout for Consultant Archives and included the following to remove the case-study posts:
[wpv-conditional if="'[wpv-post-type]' ne 'case-study'" debug="true"][wpv-post-excerpt][/wpv-conditional]
However, the archive still shows the case studies at the end of the consultant list. That is, it shows an archive of all posts for the selected taxonomy.
When I enable debug, I get the following:
####################
Debug information
####################
--------------------
Original expression: 'case-study' ne 'case-study'
--------------------
After replacing 1 general variables and comparing strings: 'case-study' ne 'case-study'
Comparing case-study to case-study
For some reason the test for 'case-study' not equal to 'case-study' is resolving as TRUE, and therefore that post is displaying in the archive list.
What am I missing?
- Stephen
The Debug information says all is correct.
The Condition should hide the post Types that are not of that type.
It is very likely that you used your plural or singular name of the Post Type instead of the Slug, in the ShortCode.
How to debug something like this?
1. Output the "Post Type" ShortCode in your Archive.
2. Navigate to the related archive
3. Copy the exact output of the Post Type ShortCode
4. Use it in the Conditional.
I tested this, with this example:
Out of the condition:<br>
Post Title: [wpv-post-title]<br>
Post Type:[wpv-post-type]<br>
[wpv-conditional if="( '[wpv-post-type]' eq 'my_type' )"]I See this only when Post Attached to taxonomy Term is of my_type[/wpv-conditional]
Can you test it again with this example?
Hi Beda.
Sorry for the delay in replying - I had to put this aside while working on a couple of other projects.
All seems to be working now, and I'm not certain why.
Yes, outputting the wpv-conditional result in the archive is a useful strategy. If I need to revisit this again for any reason, I will use this approach.
It's strange that it is suddenly working. The only changes were some other software updates which I wouldn't have thought would have any impact.
Anyway, while it's working, I'm not complaining. :o)
Thanks again for your help.
- Stephen