WordPress.org

Ready to get started?Download WordPress

Forums

AgentPress Listings
[resolved] Sorting the widget taxonomies (6 posts)

  1. hockeyhero4
    Member
    Posted 1 year ago #

    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/

  2. hockeyhero4
    Member
    Posted 1 year ago #

    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.

  3. WDBMagic
    Member
    Posted 1 year ago #

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

  4. hockeyhero4
    Member
    Posted 1 year ago #

    Very happy that it helped you, too!

  5. sheilasteer@aol.com
    Member
    Posted 1 year ago #

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

  6. hockeyhero4
    Member
    Posted 1 year ago #

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

    PremiumPress has a support website for questionsl ike yours Sheila

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic