Keyword search results show first Featured Listings with same keywords then other listings

My Hivepress local install when I was search for Keywords the results show me first Featured Listings with same keywords then other listings.

Now it doesn’t show featured listing and it shows normal listings.
Is there anything changes in my settings, would you please help me how to solve this issue. I want featured listings are shown and sorted on top in search results.

If you’re sure that featured listings that match keywords you use exist, please check if the Featured Listings per Page is not set to zero in HivePress/Settings/Listings.

It was set on 2 but still not working properly.

Please try disabling all the third-party plugins in WordPress>Plugins, and check if this issue persists. If there are any featured listings that contain particular keywords and Featured Listings per Page is set to two, they should be displayed in the top search results.

Thanks, I’ll check and inform.

Now I’ve created new customized age attribute and active index and show search in sorting menu.

Would you please help how to make this customized age attribute as default on Ascending. Currently it’s on Date but I want set it by default on Ascending age_attribute

Unfortunately there’s no way to change the default sorting order without customizations, but we plan to add an option to assign the default sorting attribute (instead of the default Date/Relevance one).

I’ve find this on WP and StackeXchange forumes:

You can use the action hook posts_orderby in your child themes functions.php:

function changeSearchSort( $orderby, $query ){
    global $wpdb;

    if(!is_admin() && is_search()) {
        $orderby =  $wpdb->prefix."posts.post_date ASC";
    }
    return  $orderby;
}
add_filter('posts_orderby','changeSearchSort',10,2);

Source via:

And more details on WP developers official website regards “posts_orderby”

Would you please help how to make this customized age attribute as default on Ascending in search results. Currently WordPress and hivepress defaults are on “Date” but I want set it by default on Ascending age_attribute

What’s your idea?! How to set default search results to show this age_attribute Ascending first ?!

Sorry, there’s no simple code snippet for this, this requires some research. Even if you set the order in SQL query using this snippet, pre-selecting the corresponding option is required in the sort drop-down and also making sure that this doesn’t affect other sorting orders.

1 Like

Thank you @ihor

Is there anyone here know how to solve this sorting issue?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.