• babum7

    (@babum7)


    Namaskaram,

    Single post not displaying by monthnum and year . But if i have two post it is displaying fine. Following code i am using.

    <?php if (have_posts()) :
    //$month = get_query_var(‘monthnum’);
    $month = (get_query_var(‘monthnum’)) ? get_query_var(‘monthnum’) : “”;
    $year = (get_query_var(‘year’)) ? get_query_var(‘year’) : “”;
    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;

    $args = array(
    ‘paged’=>$paged,
    ‘posts_per_page’ => 10,
    ‘monthnum’=>$month,
    ‘year’=>$year
    );
    $countposts=query_posts($args);
    //echo ‘the count of posts in ‘ . $month .’/’.$year . ‘ is ‘ . count($countposts);
    while (have_posts()) : the_post(); ?>
    <div class=”postDate”><big><?php echo get_the_date(‘d’); ?></big> <?php echo get_the_date(‘M Y’); ?></div>
    <div class=”postDetail”>
    <h4>” title=”<?php the_title(); ?>” rel=”bookmark”>
    <?php the_title(); ?>
    </h4>
    <p class=”author”>By:
    <?php the_author(); ?>
    </p>
    <div class=”post-excerpt”>
    <?php the_excerpt(); ?>
    </div>

    Can you tell em the solution.

    Pranam.

Viewing 1 replies (of 1 total)
  • Clarion Technologies

    (@clarionwpdeveloper)

    Hello babum7,

    Can you please check whether the single post that you are checking is of same month because the code that you have written is perfect can you please try it by removing those monthnum and year parameter and check are getting any result or not.

    Thanks

Viewing 1 replies (of 1 total)

The topic ‘Single post not displaying by monthnum’ is closed to new replies.