0
votes

The below code will display a single post (Recent post) on the home page or front page of my blog template and i want to remove the single post(Recent post) and replace it with some text say "older post " from page 2 onwards.

The problem the condition is_home() returns true when user clicks on page 2. since logically speaking it is a query request on home page . so i tried replacing is_home() with is_page(1) and also tired is_front_page() but nothing gives fruit

Here you can see the working code.

<? if(is_home()) : ?>
  <div>
    <h3>Recent Post</h3>

    <? query_posts('posts_per_page=1');
     while(have_posts()):the_post();?>

    // iteration code here

     <!-- End Single Post -->
      <?php endwhile;wp_reset_query();?>

  </div> <!-- if condition ends-->

   <? else : ?>
   <div>
    <h3>Older Post</h3>
   </div>
  <? endif;?>
1

1 Answers

0
votes

Replacing (is_home()) with (is_paged()) solved the problem.