Forums

displaying posts in a widget that are no longer on home page? (4 posts)

  1. stanwelks
    Member
    Posted 2 years ago #

    Is there a way to display the subjects of maybe 3 or 5 of the last posts that are not displaying on the home page so someone can click on them to go to that post?

    Thanks.

  2. tugbucket
    Member
    Posted 2 years ago #

    <?php $posts=query_posts($query_string . '&posts_per_page=5&offset=3'); ?>
      <?php if (have_posts()) : ?>
        <?php while (have_posts()) : the_post(); ?>
          <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
        <?php endwhile; ?>
      <?php else : ?>
    <?php endif; ?>

    that should show the titles of the 5 most recent posts besides the first three. So if you have 3 posts on your front page this is fine. If you have more, than adjust the offset number.

  3. stanwelks
    Member
    Posted 2 years ago #

    Hi tugbucket,

    Thanks so much!

    1.) Do I just place this code into a PHP code widget?
    2.) Will the user be able to click on the subject and be taken to the page?

    Thank you!

  4. tugbucket
    Member
    Posted 2 years ago #

    you put it in the PHP file and the location you want it to display and yes, the title will be a link.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.