WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Sorting the widget taxonomies

[Resolved] Sorting the widget taxonomies

  • First off – amazing plugin!

    Secondly – My search widget is working just fine, the one issue I’m having is how it’s displaying. It’s sorting my terms by MOST POSTS as opposed to Ascending/Descending.

    Test Link: http://74.53.9.50/~budpaine/totalpropertyames.com/

    Using my listings search at the top right, go to BEDROOMS.

    You can see that it’s sorting by “2 Beds, 1 Bed, 3 Beds, 4 Beds”

    Obviously, I’d like this to sort be 1, 2, 3, 4 beds. As stated earlier, currently it’s sorting by the taxonomy with the most listings.

    How may I fix this to get an ascending sort?

    http://wordpress.org/extend/plugins/agentpress-listings/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Go figure I’ve spent 3 days on this and then once I post it in the forums I figure it out:

    So, I figured out that you can change the sort by locating this file: agentpress-listings/includes/class-property-search-widget.php.

    Within this file is a line:

    $terms = get_terms( $tax, array( 'orderby' => 'count', 'order' => 'DESCEND', 'number' => 100, 'hierarchical' => false ) );

    I changed it to this:

    $terms = get_terms( $tax, array( 'orderby' => 'name', 'order' => 'ASC', 'number' => 100, 'hierarchical' => false ) );

    This fixed my bedroom issue but caused another one to arise. Now my custom taxonomies of “Square Footage” and “Price” were showing out of order.

    THE END ALL FIX TO EVERY PROBLEM was this:
    $terms = get_terms( $tax, array( 'orderby' => 'id', 'order' => 'ASC', 'number' => 100, 'hierarchical' => false ) );

    I had to order it by ID; not by count and not be name. Hopefully this helps anyone else out there that ran into these same issues.

    Thanks hockeyhero4 – I had been searching for this for a while and this fixed the same problem for me.

    Very happy that it helped you, too!

    How would you sort the listings or choose which listings get pulled for the featured listing widget?

    That should be under DIRECTORYPRESS >> DISPLAY SETTINGS >> HOMEPAGE.

    PremiumPress has a support website for questionsl ike yours Sheila

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Sorting the widget taxonomies’ is closed to new replies.