• Resolved orbital318

    (@orbital318)


    Here is the issue. I have an archive.php that I was handed, it has the different else if PHP statements to determine what gets displayed in the header and when. I have it working so when you are looking at an archive of an author’s posts it will acknowledge that we are in the author section. However I am having issues printing the name. I found the following in this section but it doesn’t make sense to me.
    http://wordpress.org/support/topic/181510

    Thanks in advance, also here is what I have on my page.

    <?php get_header(); ?>
    
     <table cellpadding="0" cellspacing="0" border="0" width="915">
        <tr>
          <td width="590" valign="top">
          <div class="archive">
    	  	<?php  if (is_category()) { ?>
    		<div class="archive_title"><div class=archive_title_for>TAG FOR </div> “<?php echo single_cat_title(); ?>”</div>
    		<?php } elseif (is_month()) { ?>
    		<div class="archive_title" style="color:#FFFFFF"><div class=archive_title_for>TAG FOR </div> <?php the_time('F, Y'); ?></div>
    		<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    		<div class="archive_title" style="color:#FFFFFF"><div class=archive_title_for>TAG FOR </div> <?php the_time('Y'); ?></div>
    		<?php /* If this is a author */ } elseif (is_author()) { ?>
    		<div class="archive_title"><div class=archive_title_for>VIEW POSTS BY </div> “<?php the_author(); ?>”</div>
    		<?php /* If this is a search */ } elseif (is_search()) { ?>
    		<div class="archive_title">Search Results</div>
    		<?php } ?>
    	</div>
        <img src="##" width="590" height="25" border="0" />
    	<div class="blog">
    	  <?php if (have_posts()) : ?>
    		<?php while (have_posts()) : the_post(); ?>
              <div class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></div>
              <img src="http://www.cartoonbrew.com/dev/wp-content/themes/CartoonBrew/images/by_<?php the_author(); ?>.gif" alt="by <?php the_author(); ?>" height="34" border="0" class="floatleft" />
              <div class="verdana floatright"><?php the_time('F j, Y g:i a') ?></div>
              <br />
              <br />
             <?php the_content('Read the rest of this entry &raquo;'); ?>
              <div class="post_footer">
                <p><span class="floatleft verdana"><?php comments_popup_link('no comments', '1 comment', '% comments'); ?></span><span class="floatright verdana">&nbsp;&nbsp;<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">permalink</a>&nbsp;&nbsp;posted in <?php the_category(',') ?></span></p>
              </div>
    		<?php endwhile; ?>
    			<div class="hr"></div>
    		<p style="padding-bottom: 30px;">
    			<span class="floatleft"><?php next_posts_link('Previous Entries') ?></span>
    			<span class="floatright"><?php previous_posts_link('Next Entries') ?></span>
    		</p>
    	<?php else : ?>
    		<div class="title">Not Found</div>
    		<p>Sorry, but you are looking for something that isn't here.</p>
    	<?php endif; ?>
            </div></td>
    
    <?php get_footer(); ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi Orbital,
    I noticed that the top of that article says “This tag must be used within The Loop”.

    That means for that function to work, you would have to put it between <?php while (have_posts()) : the_post(); ?> and <?php endwhile; ?>

    Try this:

    <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    <?php $author = get_userdata( get_query_var('author') );?>
      <h2 class="pagetitle">Author Archive for <?php echo $author->display_name;?></h2>
    <?php /* If this is a paged archive */ }

    Thread Starter orbital318

    (@orbital318)

    Oh wow thanks for your swift help blepoxp that did the trick!

    excellent!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding Author’s Name to Archive Page’ is closed to new replies.