Support » Plugin: WP-PostViews » WP_Query – how to use it?

  • Hello,

    I want to show in the sitebar of http://calatoriainimii.net/ a list of the most popular posts.

    I want to make a modified version of WP_Query.

    <?php
    $et_popular_query = new WP_Query( apply_filters( 'et_popular_query_args', array(
    'posts_per_page' => 3,
    'post_status'=> 'publish',
    'v_sortby' => 'views',
    'v_orderby' => 'desc'
    
    ) ) );
    if ($et_popular_query->have_posts()) : while ($et_popular_query->have_posts()) : $et_popular_query->the_post();
    ?>

    Unfortunately, this doesn’t work.

    Any ideas?

    http://wordpress.org/extend/plugins/wp-postviews/

Viewing 3 replies - 1 through 3 (of 3 total)
  • This is how I do it.

    $wp_query = new WP_Query();
    $wp_query->query('showposts=NUMBER&v_sortby=views&v_orderby=desc');
    $topviews = 1;
    
    if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
    blah blah 
    
    <?php  endwhile; endif; $topviews++; ?>

    Thank you so much for the kind reply, shansta!

    Socrat1s

    (@socrat1s)

    Hi, i’m trying to use a “Custom Query String” to show up the posts by the most viewed..

    I ended up with this line but it doesn’t work..

    $query = new WP_Query( array ( ‘post_type’ => ‘most_popular’, ‘sortby’ => ‘get_most_viewed’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’ ) );

    ..any suggestions?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP_Query – how to use it?’ is closed to new replies.