Skip Navigation

[Resolved] Can't Change Order of Taxonomy Term

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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Tagged: 

This topic contains 7 replies, has 3 voices.

Last updated by Nigel 5 years, 7 months ago.

Assisted by: Nigel.

Author
Posts
#1238039
POST ADMIN Meals Served Order - success!.png
POST Meals Served - failure!.png
CTO Term Order Screen.png

I am trying to:

Link to a page where the issue can be seen:

I expected to see:

Instead, I got:Attached images show the problem. I’m using plugin “Custom Taxonomy Order NE” and it is working fine on the post admin of a CPT, but not displaying properly on the post.

I have set the term to non-hierarchical, but that doesn’t help. I’m pretty sure I have exhausted all efforts to see what might not be working with the plugin. One things, drag and drop does not work on the Taxonomy Order screen of the plugin.

Can you help me with a function just to change the order of the terms as shown in the admin screen I’ve added to this ticket? It would be great if I could just skip the plugin altogether.

Thank you so much. I’m beat.

#1238080

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

"It would be great if I could just skip the plugin altogether."

Unfortunately, WordPress doesn't come with any way to custom order terms. Views queries make available the built-in WordPress options (e.g. by term_id, term name etc.).

For anything else you are going to need custom functionality.

The easiest way to add that is with an existing plugin.

I'm not familiar with the one you shared.

I know this one works: https://wordpress.org/plugins/wp-term-order/

(It is not so popular, but is from a core contributor and I trust it.)

It makes an orderby "order" option available in queries, which is to say the custom order you set on the taxonomy edit screens using drag and drop.

You still need to modify your View taxonomy queries where you are outputting the terms, but that is fairly straightforward with some code such as this:

function tssupp_custom_term_order($view_args, $view_settings, $view_id)
{
    if (in_array($view_id, array( 123 ))) { // Add as many View IDs as you need as a comma-separated list

        $view_args['orderby'] = 'order';
        $view_args['order'] = 'ASC';
    }

    return $view_args;
}
add_filter('wpv_filter_taxonomy_query', 'tssupp_custom_term_order', 101, 3);

I tested to check there are no issues with the drag and drop etc. with current Toolset versions and it seems to work fine.

#1238922
img-3.png

That plugin hasn't been updated in a year and doesn't show up in my admin after activation . I did get < part >of "Custom Taxonomy Order" (https://wordpress.org/plugins/custom-taxonomy-order-ne/) to work; it sorts the terms in the post box (img-1), but it doesn't show on the post (img-2).

In any case, I don't understand "modify View taxonomy queries where you are outputting the terms." What View, darling? I am so horribly frustrated by this. (See img-3, AHEM.)

#1238937
img-2.jpg
img-1.png

Here are the other images, sorry.

#1239010

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

How are you displaying these terms on the front end if not with a View?

#1239292
Screen Shot 2019-05-03 at 8.18.27 PM.png

By adding the tax to the Content Template (attached).

#1239891

Hi there,

Thank you for sharing the screenshot.

Nigel is away on vacation until tomorrow, so I'll be following up on this.

The shortcode [wpv-post-taxonomy] only supports showing the attached taxonomy terms in ascending or descending order ( ref: https://toolset.com/documentation/user-guides/views-shortcodes/#vf-153472 ), which is why the custom order that you've set in the admin area using the third-party plugin is not applying to the post's front-end.

You're welcome to submit a feature request to allow the support for the custom ordering of taxonomy terms, through the dedicated form, at:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

Meanwhile, to make this work, you'll need a custom shortcode that makes use of the "get_the_terms" function, to show the list of attached taxonomy terms.
( ref: https://developer.wordpress.org/reference/functions/get_the_terms/ )

In case you need personalized assistance around custom code, you can consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1240964

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Suzy

I just took another quick look at this.

Any custom ordering is not going to work when outputting the terms with the wpv-post-taxonomy shortcode.

The only solution I can suggest is to create a View to output the terms instead of using the wpv-post-taxonomy shortcode, in combination with the WP Term Order plugin and the wpv_filter_taxonomy_query to use the 'order' option provided by that plugin.

(There are no settings screens for the plugin, you just activate it and drag and drop the taxonomy terms into the order you require.)