How to display the LATEST POST ONLY on index.php
-
I want to only display the latest post on my home page, index.php , but I can not get it to work properly. I also tried one of the plugins, but that did not work either, it kept messing my page up. Is there a simple way to do this? I just need this functionality on my home page only, index.php. Here is my code:
<?php include("header.php"); ?> <!-- BEGIN content --> <div id="content"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <!-- BEGIN post --> <div class="post"> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <a href="<?php the_permalink(); ?>"><?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?></a> <?php the_excerpt(); ?> <p class="date"><?php the_time('F j, Y') ?></p> </div> <!-- END post --> <?php endwhile; ?> <p class="postnav"> <?php next_posts_link('« Older Entries'); ?> <?php previous_posts_link('Newer Entries »'); ?> </p> <?php else : ?> <div class="notfound"> <h2>Not Found</h2> <p>Sorry, but you are looking for something that is not here.</p> </div> <?php endif; ?> </div> <!-- END content --> <?php get_sidebar(); get_footer(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to display the LATEST POST ONLY on index.php’ is closed to new replies.