Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: [Assigned] Featured Posts on Top

$
0
0

Dear Scott

I have been reassigned this issue and I think that we are complicating it too much.

The problem is that with Views you can only sort on one field and you need to sort on two fields.

We already have a feature request for this, but meanwhile you need to use a few lines of code in functions.php for your theme:

add_filter('wpv_filter_query', 'featured_sorting', 10, 2);
function featured_sorting($q, $view) {
        if ($view['view_id'] == 24) {
                $q['meta_key'] = 'wpcf-is-featured';
                $q['orderby'] = 'meta_value,date';
                $q['order'] = 'DESC';
        }
        return $q;
}

You have to adjust the view id 24 to your view id. If we can get it all done with one query, pagination will work fine.

Please let me know if you are satisfied with my reply and any other questions you may have.

Regards
Caridad


Viewing all articles
Browse latest Browse all 20145