Okay so I'm trying to modify the following code which works perfectly for pulling all the posts from the previous month and creating a roundup post.
<?php
//monthly roundup
function monthly_roundup( $atts )
{
extract(shortcode_atts(array(
'monthnum' => ''
), $atts));
//The Query
$current_month = (date('m')-1);
$current_year = date('Y');
query_posts("year=$current_year&monthnum=$current_month&order=ASC&posts_per_page=-1");
echo '<h3>';
echo 'The Month In Review';
echo '</h3>';
echo '<div class="round">';
echo '<ul class="related-entries">';
//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post();
echo '<li><div class="hover"><a href="'; echo the_permalink(); echo '">'; echo '<h3>'; echo the_title(); echo '</h3><div><span>'; echo comments_number('No Comments','1 Comment','% Comments'); echo '</div></div>'; echo the_post_thumbnail('related');'</a></li>';
endwhile; else:
endif;
echo '</ul>';
echo '</div>';
//Reset Query
wp_reset_query();
}
add_shortcode('rndup', 'monthly_roundup'); ?>
This is what I'm trying but it just shows all the posts from the last year not from the previous week. Anyone know where I'm going wrong?
<?php
//weekly roundup
function weekly_roundup( $atts )
{
extract(shortcode_atts(array(
'weeknum' => ''
), $atts));
//The Query
$current_week = (date('W')-1);
$current_year = date('Y');
query_posts("year=$current_year&weeknum=$current_week&order=ASC&posts_per_page=-1");
echo '<h3>';
echo 'The Week In Review';
echo '</h3>';
echo '<div class="round">';
echo '<ul class="related-entries">';
//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post();
echo '<li><div class="hover"><a href="'; echo the_permalink(); echo '">'; echo '<h3>'; echo the_title(); echo '</h3><div><span>'; echo comments_number('No Comments','1 Comment','% Comments'); echo '</div></div>'; echo the_post_thumbnail('related');'</a></li>';
endwhile; else:
endif;
echo '</ul>';
echo '</div>';
//Reset Query
wp_reset_query();
}
add_shortcode('weeklyrndup', 'weekly_roundup'); ?>