• Resolved soapyskin

    (@soapyskin)


    Hi,

    Could you please tell me if there is a way to order the categories when they are displayed? It looks like the default is child first, parent second. I would like to swap this so that the parent is shown first and the child is shown second.
    I am currently using the following shortcode:
    [show_post_categories parent=”yes” show=”category” hyperlink=”yes”]

    Regards

    Dave

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author willemso

    (@willemso)

    Hi Dave,

    currently, no, the order is a bit depending on your WP version. In some older versions they are listed in the order you′ve added them, in others they are random.

    You are right that it would be a great option to add some sorting. However I′m extremely busy with some paid jobs right now, that′s why the updates a pretty slow atm.

    But, you can give this a try; it′s a small change in coding. Open up the code-editor under the plugins tab (admin dashboard) and select “Show Post Categories”. You′ll need to edit the file category.php on line 26 (if using standard Taxonomy).

    Modify this $categories = get_the_category($PostID); and change it to $categories = wp_get_post_terms($PostID, 'category', array( 'orderby' => 'parent', 'order' => 'ASC' ) );

    Save it, and give it a go. What it does, is order it by parent, in an ascending order.

    Please let me know if it works for you. Then I′ll include it in the source code, and will see if I can provide an additional shortcode for sorting ascending/descending).

    If you would urgently need to modify the sorting, you can use the following options:
    Orderby: ‘name’, ‘slug’, ‘term_group’, ‘term_id’, ‘id’, ‘description’, ‘parent’, ‘term_order’

    Order: ‘ASC’, ‘DESC’

    Thread Starter soapyskin

    (@soapyskin)

    Hi,
    That worked perfectly.
    Thank you
    Dave

    Plugin Author willemso

    (@willemso)

    Hi Dave,

    Thanks for the feedback!
    I will place it on my roadmap, once it′s done you′ll read it in the update FAQ.

    If you′re happy with the plugin – please leave us a review ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display order of categories’ is closed to new replies.