Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created February 22, 2013 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save billerickson/5016718 to your computer and use it in GitHub Desktop.
Save billerickson/5016718 to your computer and use it in GitHub Desktop.
<?php
// Popular Posts
$args = array(
'meta_key' => 'be_stats',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'posts_per_page' => 3,
'cat' => get_query_var( 'cat' ),
'post__not_in' => $used_posts,
);
$loop = new WP_Query( $args );
if( $loop->have_posts() ):
echo '<div class="popular-posts-listing">';
echo '<h4>Most Popular ' . $category->name . ' Posts</h4>';
while( $loop->have_posts() ): $loop->the_post();
echo '<div class="post">';
if( has_post_thumbnail() )
echo '<a href="' . get_permalink() . '">' . be_get_post_thumbnail( null, 134, 134, true ) . '</a>';
echo '<h2><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
echo wpautop( get_the_excerpt() . '&hellip;' );
echo '<p class="more"><a href="' . get_permalink() . '" class="square-button">MORE</a></p>';
echo '</div>';
endwhile;
echo '</div>';
endif;
wp_reset_postdata();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment