Archived topic
shortcode for list category terms in hierarchical order
6 replies · Started by arachno on November 18, 2020
Hi,
We need to create a shortcode that displays the linked categories in hierarchical order instead of alphabetical.
Is it possible to achieve it with a function to be placed in the functions.php file of the child theme and then set a shortcode that will be called in the article editor?
Thanks for your help
Franco
Hi there,
Sorry just to confirm, this is not what you are looking for?
https://www.screencast.com/t/TSBvW3B8G2
If not then it would require a custom solution unfortunately.
I would recommend the following two solutions:
- Try this plugin:
https://en-ca.wordpress.org/plugins/taxonomy-terms-order/
- Open a support topic with the WordPress support team and ask them if they can provide a way to modify that widget (it's a WP core widget) to the way you want.
where did you take the screenshot of the categories order box?
I see it's in the widget area but I need to place them in a hook or a specific place in the article, maybe we will use the plugin.
thanks
That's from the Widgets screen. The Categories widget is a WordPress core widget:
https://www.screencast.com/t/5KQW8w0Z13Fp
You can turn the widget into a shortcode using a plugin like this:
https://en-ca.wordpress.org/plugins/widget-shortcode/
Then add it with a hook element:
https://docs.generatepress.com/article/hooks-element-overview/
Thanks for your help !
No problem :)