Wordpress Loop show single post on index page

I am using the following code on the index.php page of my template.  This is looping and showing multiple posts instead of just the last post.  How do I update this to only show the latest post on the index page?
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>	
							<div class="content1">
								<div class="topic">
									<div class="spacer"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/spacer.gif" width="1" height="5" alt=""/></div>
									<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
									<div class="info">Author: <?php the_author_link() ?> <span><?php the_time('d.m.Y') ?></span></div>
									<div class="spacer"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/spacer.gif" width="1" height="10" alt=""/></div>
								</div>
								<div class="text511">
									<div class="text_top511">
										<?php the_content('Read the rest of this entry &raquo;'); ?>
									</div>
									<div class="spacer"><br style="clear:both;"/></div>
								</div>
								<div class="comment"><a href="<?php comments_link(); ?>">read users' comments</a> (<?php comments_number('0', '1', '%', 'number'); ?>)</div>
								<div class="spacer"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/spacer.gif" width="1" height="15" alt=""/></div>
							</div>
		
		
								<?php endwhile; ?>

Open in new window

pda4meAsked:
Who is Participating?
 
i-CONICAConnect With a Mentor Commented:
Would the attached work? Not tested, don't have a wordpress installation to hand...
<?php if ( have_posts() ) : the_post(); ?>     
                                                        <div class="content1">
                                                                <div class="topic">
                                                                        <div class="spacer"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/spacer.gif" width="1" height="5" alt=""/></div>
                                                                        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
                                                                        <div class="info">Author: <?php the_author_link() ?> <span><?php the_time('d.m.Y') ?></span></div>
                                                                        <div class="spacer"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/spacer.gif" width="1" height="10" alt=""/></div>
                                                                </div>
                                                                <div class="text511">
                                                                        <div class="text_top511">
                                                                                <?php the_content('Read the rest of this entry &raquo;'); ?>
                                                                        </div>
                                                                        <div class="spacer"><br style="clear:both;"/></div>
                                                                </div>
                                                                <div class="comment"><a href="<?php comments_link(); ?>">read users' comments</a> (<?php comments_number('0', '1', '%', 'number'); ?>)</div>
                                                                <div class="spacer"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/spacer.gif" width="1" height="15" alt=""/></div>
                                                        </div>

Open in new window

0
 
pda4meAuthor Commented:
Perfect, thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.