How to change ordering after featured listings
From JReviews Documentation
In JReviews 3 you also can use Filters to modify the listing order. Use the Pre Get Listings Listpage Query Filter.
When you set the default ordering for list pages to Featured in global configuration, the rest of the listings below featured will be ordered by submission date.
If you want to change that, edit this file:
Joomla
- com_jreviews/jreviews/cms_compat/joomla/models/everywhere/everywhere_com_content.php
WordPress
- jreviews/jreviews/cms_compat/wordpress/models/everywhere/everywhere_com_content.php
Be advised that a lot of effort has been put into optimizing the database queries and table indexes for faster performance. If you mix two columns from different database tables, the query can no longer be optimized because a index cannot be used.
Find the code for featured ordering:
case 'featured': // ... some other lines in between ... $order = 'Field.featured DESC, Field.contentid DESC';
And change it to one of the below, depending which ordering after featured listings you want:
Ordering by title
Joomla | WordPress |
$order = 'Field.featured DESC, Listing.title ASC'; |
$order = 'Field.featured DESC, Listing.post_title ASC'; |
Ordering by creation date
Joomla | WordPress |
$order = 'Field.featured DESC, Listing.created DESC'; |
$order = 'Field.featured DESC, Listing.post_date DESC'; |
Ordering by most viewed listings
Joomla | WordPress |
$order = 'Field.featured DESC, Listing.hits DESC'; |
$order = 'Field.featured DESC, PostView.meta_value'; |
Ordering by highest user rating
$order = 'Field.featured DESC, Totals.user_rating DESC, Totals.user_rating_count DESC';
Ordering by highest editor rating
$order = 'Field.featured DESC, Totals.editor_rating DESC, Totals.editor_rating_count DESC';
Ordering by number of reviews
$order = 'Field.featured DESC, Totals.user_comment_count DESC';
Ordering by custom field
$order = 'Field.featured DESC, Field.jr_fieldname ASC';