Support » Themes and Templates » Latest Posts on Static Front Page

  • Hello, I’ll keep it quick.

    I wanted my friend to be able to update their own home page text.

    I decided to create a “Home” Page and a “Blog” Page then change the “Reading” settings in admin to:

    Front Page= Home
    Posts Page= Blog

    I made a copy of the index.php and turned it into a template to apply to my new “Home” page.

    This works great as I now have a homepage that acts like the regular index page and also a Blog page for listing the latest posts.

    What i would now like to do is have a list of the two latest posts on my new Home page, but can only get it to display a bullet list using:

    <?php wp_get_archives(‘type=postbypost&limit=15’); ?>

    I basically want it to have the excerpt and eventually a thumb also.

    Any help would be entirely appreciated.


Viewing 2 replies - 1 through 2 (of 2 total)
  • You could check this snippet of code.

    <?php query_posts('showposts=2&order=DESC'); ?>
        <?php if (have_posts()) : while (have_posts()) : the_post();?>
         [GET YOUR content EXEMPLE]
         <!-- The title of the post -->
         <php the_title() ?>
         <!-- The excerpt -->
         <?php the_excerpt() ?>
        <?php endwhile; endif; ?>

    With your query, you will be able to get the 2 lastest posts with the ‘Showposts’ and the ‘order’ by DESC.

    By using the query you will do your ‘While’ to get the two posts

    Hope it will help

    $my_query = new WP_Query('showposts=2');
    while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;

    Use this code. Hope it will help you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Latest Posts on Static Front Page’ is closed to new replies.