WordPress.org

Ready to get started?Download WordPress

Forums

How to Create a Page that Acts like a Home Page (3 posts)

  1. titanvex
    Member
    Posted 1 year ago #

    I am looking to create a page that acts just like the index.php file would.

    Basically, I want a list of my most recent posts, but not on the home page. I have the home page set as a static page, but want to take the code that is normally there (which displays the recent posts), and have that be on a different page (by using a Page Template).

    I can get the code to work on the home page, but when I copy it over to a page template, none of the recent posts show up. I am not sure what I have to do special to fix this. I am not the best at php, but I do have a basic understanding.

    Any help would be appreciated. Thank you very much.

    -TitanVex

  2. Chandan Kumar
    Member
    Posted 1 year ago #

    Can you share your code that you are using to display recent posts?

  3. titanvex
    Member
    Posted 1 year ago #

    I totally would, but I figured it out after I posted this!

    I had a HUGE amount of code before, but I found that it could be simplified to:

    <?php query_posts('showposts=5'); ?>
    <ul>
    <?php while (have_posts()) : the_post(); ?>
    <li><a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'thumbnail' ); ?></a></li>
    <?php endwhile;?>
    </ul>

    It works like a champ. Thank you for your help though!

Topic Closed

This topic has been closed to new replies.

About this Topic