Skip Navigation

[Resolved] Query taxonomy view by the post it’s displayed on

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

Problem:
How can I create a list of Taxonomy Terms, that are assigend to a Post, and display this list on my single Posts in their Content Template?

Solution:
Create a View of Taxonomies.

In the taxonomy View Query Section set:

Taxonomy is set by the current post

In the Loop of the View, you call the taxonomy Term Information you want to display.

Finally insert the View to your content Template.

Relevant Documentation:
https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/

This support ticket is created 7 years, 11 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 replies, has 2 voices.

Last updated by TJS3586 7 years, 11 months ago.

Assisted by: Beda.

Author
Posts
#397041

I've create a custom post type of "faculty" and a custom taxonomy of "departments". I want to embed a taxonomy view of the departments into the faculty content template. But the current taxonomy view just shows all of the terms in that taxonomy and is not queried based on the current post being viewed.

This is what I have in the content template:

[wpv-view name="departments" limit="1"]

This is what the View loop looks like:

<ul class="wpv-loop js-wpv-loop">
		<wpv-loop>
			<li>[wpv-taxonomy-title]</li>
		</wpv-loop>
	</ul>

I also tried just showing the field using

[wpv-post-taxonomy type='department' format='name']

in the content template. But I need to be able to limit and offset the terms shown, which is why I'm trying to use a view.

#397172

You want View of Taxonomy terms set by the current post.

This is to do in the taxonomy View Query Section.
You will set a Query as this:
[php]Taxonomy is set by the current post[php]

In the Loop then you call the taxonomy Term Information you want to display.
And insert the View to your content Template.

This should work flawlessly

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

#397589

Genius!

Thank you so much. I knew there had to be a way, I just couldn't find the right document to explain it to me.

Thank you so much!

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