Loop the index plug-in jeckpack post view

I’m trying to get my index of the loop in order list for viewing. I’m using Jetpack Post Views for this

Ex: the most viewed post is first and so on.

Read More

I use a custom post with namo movies , only queensize my loop is not bringing this custom post.

Could anyone help me ?

<div id="content">
<?php if( function_exists( 'stats_get_csv' ) ) :
    $top_posts = stats_get_csv( 'postviews', array( 'days' => 21, 'limit' => -1 ) );
    $top_ids = array();
    foreach ( $top_posts as $top_post ) {
        $top_ids[] = $top_post['post_id'];
    }

    // Check for transient, hat tip Greg Rickaby
    if ( false === ( $tops = get_transient( 'popular_posts' ) ) ) :

        $top_args = new WP_Query( array(
        'posts_per_page' => '5',
        'post__in' => $top_ids,
        'posts_per_page' => 14,
        'post_type' => array('movies')
        )
    );
     $tops = new WP_Query( $top_args );

        // Store transient and expire after 24 hours
        set_transient( 'popular_posts', $tops, 24 * HOUR_IN_SECONDS );

    endif; 
while ($tops->have_posts()) : $tops->the_post(); ?> 

<div class="box " id="post-<?php the_ID(); ?>">

<div class="boxim">
<?php
if ( has_post_thumbnail() ) { ?>
    <a href="<?php the_permalink() ?>"><img class="boximg" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&amp;h=270&amp;w=180&amp;zc=1" alt=""/></a>
<?php } else { ?>
    <a href="<?php the_permalink() ?>"><img class="boximg" src="<?php bloginfo('template_directory'); ?>/images/dummy.png" alt="" /></a>
<?php } ?>

<div class="scorebox">
<span class="sholder"> <span class="scorebar score-<?php $rscore=get_post_meta($post->ID, 'wtf_rscore', true); echo $rscore; ?>"> </span>    </span>
</div>

</div>

<div class="boxentry">
<div class="btitle">
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
</div>
<div class="bmeta">
<span class="mgenre"><?php echo get_the_term_list( $post->ID, 'movie-genre', '', ', ', '' ); ?></span> <span class="mcom"><?php comments_popup_link('0', '1', '%'); ?></span>
</div>
<div class="clear"></div>
</div>
</div>

<?php if(++$counter % 3 == 0) : ?>
<div class="clear"></div>
<?php endif; ?>

<?php endwhile; wp_reset_postdata(); ?>

<div class="clear"></div>
<?php getpagenavi(); ?>
<?php endif; ?>

</div>

Related posts

Leave a Reply