There is no setting to put featured listings at the top of GeoDirectory search results. Search pages use their own order: when someone searches near a place, results are sorted by distance, and when they search with keywords, by how well the title and description match. The sort options you set for a post type only change the order on category and other archive pages.
Featured first on archive pages
- Go to Places > Settings > Sorting.
- Add the Featured field as a sort option (descending, so featured listings come first) and set it as the default sort.
- To decide the order inside each group, add a second sort under it, such as newest first or highest rated.
- Save.
More on sorting: Changing or adding new sorting options.
Featured first on search results
For the search page, add this snippet with the Code Snippets plugin or in your child theme’s functions.php. It puts featured listings first and keeps the normal search order (distance or relevance) within the featured and non-featured groups.
/**
* Show featured listings first on GeoDirectory search results.
*/
function my_gd_featured_first_on_search( $orderby, $sort_by, $table, $query ) {
if ( geodir_is_page( 'search' ) && geodir_column_exist( $table, 'featured' ) ) {
$featured = $table . '.featured DESC';
$orderby = trim( $orderby ) !== '' ? $featured . ', ' . $orderby : $featured;
}
return $orderby;
}
add_filter( 'geodir_posts_order_by_sort', 'my_gd_featured_first_on_search', 20, 4 );
This needs the Featured field on the post type, which GeoDirectory adds by default. With the snippet active, a featured listing further away comes before a closer non-featured one.