Forums

Replace Post header on first post (5 posts)

  1. RealEmotionX
    Member
    Posted 1 year ago #

    I want to replace the Post name and date on the first page of my site

    http://realemotionx.net/rexcast

    With an image. I know this would involve modifying the Loop. But I dont know with exactly what. Any Suggestions?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    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;?>
  3. RealEmotionX
    Member
    Posted 1 year ago #

    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(); ?>
  4. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

  5. RealEmotionX
    Member
    Posted 1 year ago #

    Bingo. Did the trick. Thanks for the help! :D

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.