Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $wp_query= null;
- $wp_query = new WP_Query();
- $args = array(
- 'post_type' => 'post',
- 'category_name' => 'featured',
- 'orderby' => 'comment_count',
- 'showposts' => '10',
- '&paged' => $paged,
- );
- // posts in the last two weeks
- function jgl_filter_where( $where = '' ) {
- $where .= " AND post_date > '" . date('Y-m-d', strtotime('-2 weeks')) . "'";
- return $where;
- }
- add_filter( 'posts_where', 'jgl_filter_where' );
- $wp_query->query( $args );
- remove_filter( 'posts_where', 'jgl_filter_where' );
- ?>
- <?php if ( $wp_query->have_posts() ) : ?>
- <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
- <li>
- <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
- <span>
- <a class="comments" href="<?php the_permalink(); ?>#comments"><?php echo $post->comment_count; ?> Comments</a>Posted Under: <?php the_category(', '); ?>
- </span>
- </li>
- <?php endwhile; ?>
- <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement