Skip Navigation

[Resolved] Using single (primary) category in link when there are more than one categories

This support ticket is created 5 years, 7 months ago. 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.

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

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Shane 5 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#1288757

Tell us what you are trying to do? Set up a dynamic link on a post template that will take users to that posts category

Is there any documentation that you are following? Nope, making this one up as I go along...

Is there a similar example that we can see? I'm currently using this code:

<div class="more-button">More {!{wpv-post-taxonomy type='category' format='name'}!}</div>

What is the link to your site? You can see this in action on this page - hidden link

Below the main content but above the Instagram block.

My issue is that, if the post is in more than one category, the link shows them all. Is there a way to use just the Primary category, or even just the first category that the system finds?

Any thoughts welcomed.

Kind regards
James

#1288875

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi James,

Thank you for getting in touch.

This is actually an easy fix, what you need to do is create a view, a taxonomy view that is listing out the current taxonomy for the posts.

To do this add a Taxonomy Term query filter to the view and set it to display for the current post or page or view, whichever is the one you are using to display the post.

Then just add this view to the parent.

This the code in the taxonomy view

<div class="more-button"><a href="[wpv-taxonomy-url]">More [wpv-archive-title]</a></div>


Please let me know if this helps.

Thanks,
Shane