• Can someone point me in the right direction.

    I want an exerpt of the latest post on the home page, but an index of posts in domain.com/blog/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter stilfx

    (@stilfx)

    Figured it out.

    1) Create a new page called home, save it.
    2) Create a new page template, and name it home.
    3) Update the home page to use the home template.
    4) Settings > Reading > Select the home page as your front page.
    5) Add this code to your home page template to pull the latest post

    <?php $recentPosts = new WP_Query(); $recentPosts->query('showposts=1'); ?>
    <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
    <h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
    <div id="exerpt"><?php the_excerpt(); ?></div>
    <p class="readMore"><a href="<?php the_permalink();?>">more &raquo;</a></p>
    <?php endwhile; ?>

    *Notice this code it set up to only show the excerpt of the latest post (the_excerpt(); and showposts=1).

    Greetings.

    Thanks for the help. Can you or anyone answer a few questions I am running up against?

    1. I add:

    <?php
    /*
    Template Name: Home
    */
    ?>

    to the page.php, but don’t understand the next step to creating a unique page template. What is the step I am missing?

    2. Can I move the excerpt to different part of the page?

    Thanks,

    Sara

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Home page exerpt, with blog page’ is closed to new replies.