Skip Navigation

[Resolved] display wpv-post-taxonomy and hierarchical taxonomies

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

Problem:
How to display or show post taxonomy hierarchial

Solution:
There is no such feature available with views that you can display taxonomy terms attached to the particular post in hierarchical order.

However, I have a workaround for you that may help you to resolve your issue.

You can find proposed solution with the following reply:
https://toolset.com/forums/topic/display-wpv-post-taxonomy-and-hierarchical-taxonomies/#post-410285

Relevant Documentation:

This support ticket is created 7 years, 10 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by nansS 7 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#410057

I am trying to:

hello
I have a custom taxonomy with parents and child
like
- ZZZ : ROOT CATEGORY
-- EEE : SUB CATEGORY
---- AAA : SUB SUB CATEGORY

i would like to display post taxonomies ordered by hierarchical order with wpv-post-taxonomy shortcode.

I've created a template with the shortcode [wpv-post-taxonomy type='my-tax-slug' separator=' / ' order='asc']

i've tested asc, and desc (and group) order but I would like to order by hierarchical order

I expected to see:

ZZZ / EEE / AAA

Instead, I got:

AAA / EEE / ZZZ

Could you give me the way to display my taxonomies by hierarchical order ?

best regards

#410285

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

There is no such feature available with views that you can display taxonomy terms attached to particular post in hierarchical order.

However I have workaround for you that may help you to resolve your issue.

Please try to add following code to your current theme's functions.php file.

function list_hierarchical_terms($atts) {
	global $post;
	
	
	$taxonomy = $atts['taxonomy']; // change this to your taxonomy
	$separator = $atts['separator'];
	$terms = wp_get_object_terms( $post->ID, $taxonomy, array( "fields" => "ids" ) );
	if( $terms ) {
		$terms = trim( implode( ',', (array) $terms ), ' ,' );
		return wp_list_categories( 'title_li=&taxonomy=' . $taxonomy . '&include=' . $terms."&hierarchical=1"."&separator=".$separator."&echo=0&style=none");
		
	}
}
add_shortcode('display_post_tax_terms_hierarchical', 'list_hierarchical_terms');

User shortcode as:

[display_post_tax_terms_hierarchical taxonomy="vehicle-type" separator="/"]

Where:
Replace "taxonomy" with your taxonomy slug and separator as you want.

I hope above solution will help you to resolve your issue.

#410876

hello
thanks a lot i'ts working.
I think you should add this feature natively in your plugin, this problematic is a recurrent one a thnik

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