Forums

[resolved] How to ignore latest post (3 posts)

  1. mayoosuf
    Member
    Posted 4 years ago #

    Hi guys, i wanted a small help on how to ignore the latest post form the below loop

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
          <div class="post">
            <!-- Display the Title as a link to the Post's permalink. -->
            <h2><a href="<?php the_permalink(); ?>">
              <?php the_title(); ?>
              </a></h2>
            <!-- Display the Time. -->
            <small>on
            <?php the_time('F jS, Y'); ?>
            in
            <?php the_category(', '); ?>
            </small>
            <!-- Display the Post's Content in a div box. -->
            <?php the_content(); ?>
           <!-- <a href="" class="button">Read More</a>-->
            <div class="separator"></div>
          </div>
          <?php endwhile; ?>
  2. renato_s
    Member
    Posted 4 years ago #

    Place a query_posts just before the loop and use the "offset" parameter:

    http://codex.wordpress.org/Template_Tags/query_posts#Offset_Parameter

  3. mayoosuf
    Member
    Posted 4 years ago #

    Hi Renato
    hmm, you mean that i have to make the code like;

    <?php if ( have_posts() ); ?> 
    
    <?php
    query_posts('showposts=5&offset=3'); 
    
    #it displays 5 records  and offset frm third
    ?>
    <?php while ( have_posts() ) : the_post(); ?>
          <div class="post">
            <!-- Display the Title as a link to the Post's permalink. -->
            <h2><a>">
              <?php the_title(); ?>
              </a></h2>
            <!-- Display the Time. -->
            <small>on
            <?php the_time('F jS, Y'); ?>
            in
            <?php the_category(', '); ?>
            </small>
            <!-- Display the Post's Content in a div box. -->
            <?php the_content(); ?>
           <!-- <a href="">Read More</a>-->
            <div class="separator"></div>
          </div>
          <?php endwhile; ?>

    Thank you very much!!!!

Topic Closed

This topic has been closed to new replies.

About this Topic