• Resolved SJS719

    (@sjs719)


    Hey guys,

    I am using the Vantage theme by AppThemes to create a business directory and I am having a problem with sorting my listing categories by custom order rather than alphabetically. I am not referring to the Category Page or the menu item, I am talking about the categories which are displayed next to the business within the list of listings and on the business’s page.

    For example, the business listings look something like this:

    AAA Handyman Service
    1752 Grandview St., Colorado Springs, CO 80929
    General Services, Handyman, Home Repairs, Kitchen Work, Repairs, Tool Rental

    But I need to be able to sort the categories in a custom order so that I can display the more important categories first and the specific categories last.

    I am currently displaying the categories via <p class=”listing-cat”><?php the_listing_categories(); ?></p>

    Any ideas?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Chad

    (@lynneandchad)

    I haven’t used it myself, but you may want to give this plugin a try.

    Let me know how it works!

    Thread Starter SJS719

    (@sjs719)

    Hi Chad,

    Thanks for your response. I have already tried this plugin, it works great to reorder the display of your taxonomies in the menu and category pages, but it doesn’t effect the order of taxonomies attached to a listing or post. For example, if I run a search for a certain business in my area the query results will display their taxonomies in alphabetical order rather than the order I specified through the plugin.

    Thanks.

    Chad

    (@lynneandchad)

    is the_listing_categories() your own function? or something specific to your theme?

    Thread Starter SJS719

    (@sjs719)

    Sorry it is a theme specific function of the theme “Vantage” by Appthemes.

    https://www.appthemes.com/themes/vantage/

    Chad

    (@lynneandchad)

    That complicates things a bit. Your best bet is probably to reach out to the theme developer.

    Chad

    (@lynneandchad)

    I know it takes you away from that function, which is probably part of the benefit of your theme, but could you list the categories with a native WordPress function like wp_list_categories, or get_categories?

    The above plugin will reorder those lists for you.

    Thread Starter SJS719

    (@sjs719)

    I can’t use the native WordPress category functions because the categories I need to display are the categories of a custom page type called “Business Listing” and the wp_list_categories and get_categories functions displays the “post categories”.

    Chad

    (@lynneandchad)

    Yeah, sorry. Those were bad suggestions on my part.

    I have to assume these listing categories are just a custom taxonomy –
    I’m pretty sure that plugin can filter the output of get_terms(); though – maybe that would do it?

    Thread Starter SJS719

    (@sjs719)

    Yeah that plugin does reorder custom taxonomies but the custom order only applies to backend and menu items on frontend. I haven’t seen anything allowing me to reorder get_terms(); or any other functions which pull categories or taxs.

    Chad

    (@lynneandchad)

    I just tested to make sure, and it does reorder get_terms.

    Make sure the Auto Sort option is turned on in the plugin options (comes up under settings)

    Or, if you don’t want it reordering every query, it looks like you can leave that setting off and just call get_terms( 'orderby=term_order' ); (with whatever parameters you need, of course.

    Thread Starter SJS719

    (@sjs719)

    Hey Chad, you are correct this plugin can indeed custom sort categories and taxonomies through query and I finally got it working! Thank you very much for your help Chad!

    Chad

    (@lynneandchad)

    Awesome! ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Custom Sort Categories’ is closed to new replies.