Support » Themes and Templates » Show post from same category same month

  • I need to show something like this in the single template if the post is magazine category show all the post that was published in same month from only that category. I tried the following.

    $current_year = get_the_date('j',$the_post->post_parent);
    $current_month = get_the_date('F',$the_post->post_parent);
    query_posts($query_string . '&cat=1700&order=DESC&year=$current_year&monthnum=$current_month');
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <li> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; endif; ?>
    <?php wp_reset_query(); ?>

    Thanks in advance

  • The topic ‘Show post from same category same month’ is closed to new replies.