OnPoint Plugins

  • Plugins
    • Advanced Sidebar Menu
    • Go Live Update Urls
  • About
    • Services
    • Showcase
  • Blog
  • Contact
  • Support
  • Log In
← Back to support

custom order for taxonomy terms

Resolved

Requested: 1 year and 6 months ago

Hi, I have a custom taxonomy called “sources” with several hundred terms and child terms. I would prefer to use the categories widget not the navigation menu widget because the latter requires manual creation (again, I have hundreds) whereas the former is incredibly convenient. The problem is that I don’t want to order my terms by creation date, name, slug or count. I need a custom order because my terms have names like Part 1, Part 11, Part 4A, Item 6 etc., and I created them at various times, and their count isn’t relevant, so none of the ordering options work for me. As I said I would really rather not create hundreds of menu items as an alternative. I have tried adding the custom term meta field “rank” and copied your “orderby.php” file into my child theme and added a “rank” option, but without success. Is there any way to accomplish what I want? See the sidebar menu at the url below. The top level is one of my child terms in the “sources” taxonomy and the other items are grandchildren. Thanks. 

Plugin: Advanced Sidebar Menu

  1. OnPoint Plugins

    1 year and 6 months ago

    Hi Leslie,

    The easiest way to order your terms by a custom order, is to use a plugin like Simple Taxonomy Ordering. This will allow you to drag/drop the order of your terms and have the custom order reflected in the widgets.

    Disclaimer: We are not the author of the suggested plugin nor do we offer support for it.

    Have a great day!

  2. Leslie McCallum

    1 year and 6 months ago

    Hi, the time it takes to manually order my terms is what I am trying to avoid, since I have hundreds of them. Otherwise, I could just use your navigation menu option instead of categories. Please let me know if there is any way to automate a custom order for taxonomy terms. Thanks.

  3. OnPoint Plugins

    1 year and 6 months ago

    Hi Leslie,

    What would the order be based on?

  4. Leslie McCallum

    1 year and 6 months ago

    Hi, as noted in my original question, I would like to order them by a custom term meta field “rank.”

  5. Leslie McCallum

    1 year and 6 months ago

    I have tried this without success, in my child functions.php:

    add_filter(‘advanced-sidebar-menu/menus/category/order-by’,’order_by_rank’, 10, 4);
    function order_by_rank( $orderby, $widget_args, $widget_values, $menu_class ){
    $orderby = ‘rank’; //orders sources by rank
    return $orderby;
    }

    I have also tried copying your order_by.php file into my child theme folder and adding ‘rank’ as an option in place of ‘slug’ but my knowledge of php clearly isn’t strong enough. Thanks.

     

  6. OnPoint Plugins

    1 year and 6 months ago

    Hi Leslie,

    WordPress does not support ordering terms by a meta field out of the box, but you may do so with some creative filters.

    Assuming:

    1. Your taxonomy slug is ‘sources’.
    2. Your meta field key is ‘rank’.

    Have a great night!

  7. Leslie McCallum

    1 year and 6 months ago

    Wow, thank you so much. Just like that, because you were kind enough to write code for me, my problem is solved. Thanks again.

New Response Cancel reply

You must be logged in to respond. Only PRO members are allowed to respond to support requests.

© 2023 · WordPress Development · Terms Of Service · Privacy Policy · Cookie Policy · Log in

  • Plugins
  • Blog
  • Contact