WordPress.org

Support

Support » Plugins and Hacks » WP Favorite Posts » Sort by Favorite post in WP query

Sort by Favorite post in WP query

  • I have the below WP query to oepn a page and sort items by “sales count”
    I would like to modify this query and replace it to work with Wp Favorite Posts. Essentially sorting it from most favorite post.

    <?php
    $cat_id='-8';//the category ID
    $limit = get_option('posts_per_page');
    
    query_posts(array(
    'showposts'=>32,'more' => $more = 0,
    'orderby'  => 'meta_value',
    'meta_key' => 'sales_count',
    'order' => 'DESC',
    ));?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    Which values do I have to enter above for it to work?

    http://wordpress.org/extend/plugins/wp-favorite-posts/

Viewing 1 replies (of 1 total)
  • Solution:

    <?php
    $cat_id='-8';//the category ID
    $limit = get_option('posts_per_page');
    
    query_posts(array(
    'showposts'=>32,'more' => $more = 0,
    'orderby'  => 'meta_value',
    'meta_key' => 'wpfp_favorites',
    'order' => 'DESC',
    ));?>
Viewing 1 replies (of 1 total)
  • The topic ‘Sort by Favorite post in WP query’ is closed to new replies.
Skip to toolbar