Tell us what you are trying to do?
I'm using Views to show hierarchical Taxonomy views.
Is there any documentation that you are following?
Support tickets from this forum
hidden link < this is the wrong version.
What I want basically is to have the hierarchy in the taxonomy to be displayed in a more organized fashion?
I'll type and example with this link,
How I want to show it:
Alfa Romeo 145 > 1.3 (.../98)
Alfa Romeo 146 > 1.9 Td (95/97), 2.0 D Td (95/...)
Alfa Romeo 155 > 1.7I, 1.8, 2.0, 2.5 V6 - (90/94)
Alfa Romeo 164 > (90/94)
or
Alfa Romeo > 145 > 1.3 (.../98)
Alfa Romeo > 146 > 1.9 Td (95/97), 2.0 D Td (95/...)
Alfa Romeo > 155 > 1.7I, 1.8, 2.0, 2.5 V6 - (90/94)
Alfa Romeo > 164 > (90/94)
But basically to keep the hierarchy instead of the ordered by idk what metric.
The view in question is:
Taxonomy > order by term name > filter > page
and
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
<tr>
<td>[wpv-taxonomy-title]</td>
</tr>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-layout-end]
What is the link to your site?
hidden link
Hi,
Thank you for contacting us and I'd be happy to assist.
To suggest the most efficient way to achieve this, I'll need to see exactly how this taxonomy view is set up in the admin area.
Can you please share temporary admin login details, in reply to this message?
Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.
regards,
Waqar
Thank you for sharing these details.
During my testing and research, I was able to show the attached taxonomy terms in the hierarchal layout, using a custom shortcode:
add_shortcode('show_herarchical_terms_custom', 'show_herarchical_terms_custom_func');
function show_herarchical_terms_custom_func($atts) {
$data = shortcode_atts( array(
'taxonomy' => '',
'post_id' => do_shortcode('[wpv-post-id]'),
), $atts );
// Get the term IDs assigned to post.
$post_terms = wp_get_object_terms( $data['post_id'], $data['taxonomy'], array( 'fields' => 'ids' ) );
if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) {
$term_ids = implode( ',' , $post_terms );
$terms = wp_list_categories( array(
'title_li' => '',
'echo' => false,
'taxonomy' => $data['taxonomy'],
'include' => $term_ids,
) );
ob_start();
echo '<ul class="custom-herarchical-terms">';
print_r($terms);
echo '</ul>';
return ob_get_clean();
}
}
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.
After that, you can remove the shortcode for the taxonomy view "Apli-F" and use this new shortcode, like this:
[show_herarchical_terms_custom taxonomy="fabricante"]
Note: In this example, I've used the taxonomy slug "fabricante", but you can change that to show the list from other taxonomies too.
Note: The custom code examples from our forum are shared to get you started in the right direction. You're welcome to adjust them as needed and for more personalized customization assistance, you can consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
It's ok for now, I'll have to check what I can pass to wp_list_categories in order to style it further sin an ul isn't exactly what I had in mind! Thank you.