Getting images to always appear in the first post
-
Hi,
I am trying to code the home page of my site so that 2 images always appear with the top post. The page I am taking about can be seen here –
https://development.linearg.com/hbThe “Featured Recipe” and “Subscribe to our newsletter” are the images I am talking about. At present, I have added them to the latest post (where all the keyboad-mashing text is appearing), but if I add a new post, that new post will appear at the top, only without the images.
So I was thinking that a better solution would to add the images into the template code rather than add them to the post.
The problem is that the code has a “while” look that gets the latest posts (limited to 2). Obviously if I add the code to the template then the images will appear on both posts. The logical solution would be to have an If statement along the lines of:
If the post is the latest post then show these 2 images.I just don’t know how to do this, and would appreciate any assistance. I am using the Deep Silent template, and the code for the page is:
<?php get_header(); ?> <div id="content" class="narrowcolumn"> <div class="content-inside"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="left"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <div class="entry1"> <?php the_content('Read the rest of this entry ?'); ?> </div> </div> <?php endwhile; ?> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?> <?php endif; ?> </td> </tr> </table> </div> </div> </div> <?php get_footer(); ?>
Any help will be greatly appreciated.
Thanks
Simon
- The topic ‘Getting images to always appear in the first post’ is closed to new replies.