Title: Replace Post header on first post
Last modified: August 19, 2016

---

# Replace Post header on first post

 *  [RealEmotionX](https://wordpress.org/support/users/realemotionx/)
 * (@realemotionx)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/replace-post-header-on-first-post/)
 * I want to replace the Post name and date on the first page of my site
 * [http://realemotionx.net/rexcast](http://realemotionx.net/rexcast)
 * With an image. I know this would involve modifying the Loop. But I dont know 
   with exactly what. Any Suggestions?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/replace-post-header-on-first-post/#post-1724317)
 * Try something like:
 *     ```
       <?php $c = 0;
       if (have_posts()) :  while (have_posts()) : the_post(); $c ++;?>
   
       <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
       <?php if( $c ==1 ) : ?>
       <img src="<?php bloginfo('template_directory'); ?>/images/my-image.jpg" width="xx" height="yy" alt="<?php the_title(); ?>" />
       <?php else :?>
       <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
       <?php the_time('F jS, Y') ?>
       <?php endif;?>
       ```
   
 *  Thread Starter [RealEmotionX](https://wordpress.org/support/users/realemotionx/)
 * (@realemotionx)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/replace-post-header-on-first-post/#post-1724396)
 * I tried putting this in, but the PHP freaks out.
 * Suggestions?
 *     ```
       <?php get_header(); ?>
   
       <div id="content">
       	<div class="postgroup">
   
       <?php if (have_posts()) : ?>
       	<?php while (have_posts()) : the_post(); ?>
   
       		<div class="post" id="post-<?php the_ID(); ?>">
       			<div class="title">
       				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
       				<p>
       					<span class="date"><?php the_time('F j, Y'); ?></span>
       					<span class="divider">&bull;</span>
       					<span class="categories"><?php the_category(', ') ?></span>
       					<span class="divider">&bull;</span>
       					<span class="comments"><?php comments_popup_link('Comments', 'Comments', 'Comments'); ?></span>
       				</p>
       			</div>
       			<div class="entry">
       				<?php the_content('[View Show Notes]'); ?>
       			</div>
       		</div>
   
       	<?php endwhile; ?>
   
       	<div id="pagenav"><!-- <?php if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { posts_nav_link(); } ?>--></div>
   
       <?php else : ?>
   
       		<div class="post">
       			<div class="title">
       				<h2>No Archive Found</h2>
       			</div>
       			<div class="entry">
       				<p>Sorry, but you are looking for an archive that isn't here.</p>
       			</div>
       		</div>
   
       <?php endif; ?>
   
       	</div>
       </div>
   
       <?php get_sidebar(); ?>
       <?php get_footer(); ?>
       ```
   
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/replace-post-header-on-first-post/#post-1724421)
 * [http://wordpress.pastebin.com/Y2Mc6aP5](http://wordpress.pastebin.com/Y2Mc6aP5)
 *  Thread Starter [RealEmotionX](https://wordpress.org/support/users/realemotionx/)
 * (@realemotionx)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/replace-post-header-on-first-post/#post-1724458)
 * Bingo. Did the trick. Thanks for the help! 😀

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Replace Post header on first post’ is closed to new replies.

 * 4 replies
 * 2 participants
 * Last reply from: [RealEmotionX](https://wordpress.org/support/users/realemotionx/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/replace-post-header-on-first-post/#post-1724458)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
