Change display order of 'Taxonomy List Shortcode' Plugin also add tax images (2 posts)

  1. theendtimes
    Posted 5 years ago #


    Basically I am trying to change the display order of the 'Taxonomy List Shortcode' plugin

    I would like the order to be changed to- newest taxonomy to oldest taxonomy or DESC instead of ASC which seems to be the default...

    P.S How can I implement the taxonomy images right next to the title of the taxonomy within the list?

    THANK YOU SO VERY MUCH for the help in advance!

  2. Michael Fields
    Posted 5 years ago #

    I would like the order to be changed to- newest taxonomy to oldest taxonomy.

    Unfortunately, WordPress does not store date information for each term. Technically, this is not really possible. You can work around this by setting the order argument of get_terms() to DESC. IF the orderby argument is left to it's default value, the terms will returned in the order which they were added to the database.

    This can be very misleading as term_id's are shared across taxonomies.For example. IF you have a category named "Taco" that you created last year and then you add a tag named "Taco" right now. The term_id will not change. WordPress will recycle the term_id, name and slug from the term added last year.

    The next best solution might be to hook into the 'get_terms_orderby' hook and modify it to use term_taxonomy_id only for the current call to get_terms(). Just be sure to set the cache_domain argument to something unique to your site if going this route.

    Even at this stage ... this is still a bit hacky IMHO. Terms will be returned in the order that they were entered into the database, which should "work" but is still not perfect. Auto incremented numeric keys should never be trusted to be in any sort of order - rather only as unique identifiers.

    Unfortunately, this plugin does not support modifying the order argument at the present time. I've been working on-and-off on a complete rewrite of this plugin with template support + full support of the Taxonomy Images plugin. May be time to finish it up and release it!


Topic Closed

This topic has been closed to new replies.

About this Topic