WordPress.org

Ready to get started?Download WordPress

Forums

Author name and some author meta information not appearing with post (1 post)

  1. matthewjepearson
    Member
    Posted 4 years ago #

    I have been editing the css and html of the default theme to style it to match my current site. All fine until now.

    I wanted to show authors names under the post title. I have tried a few ways of doing this with no success.

    Firstly after not getting them to appear with a post, I got the list of author names to appear in the side bar. After this success I created an author.php file and this correctly showed names in an authors page etc. Using this code outside 'the loop':

    <!-- This sets the $curauth variable -->
    	<?php if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($author_name); else : $curauth = get_userdata(intval($author)); endif;  ?>
    	<h2>About: <?php echo $curauth->nickname; ?></h2>
    	<dl>
    		<dt>Website</dt>
    		<dd><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></dd>
    		<dt>Profile</dt>
    		<dd><?php echo $curauth->user_description; ?></dd>
    	</dl>
    	<h2>Posts by <?php echo $curauth->nickname; ?>:</h2>

    I put the same code in single.php (above the loop) and no values were shown at all. I tired putting this code from the postmetadata part of the codex in (http://codex.wordpress.org/Post_Meta_Data_Section)

    POST TITLE: <?php the_title(); ?><br />
    AUTHOR: <?php the_author(); ?><br />
    POSTED: <?php the_time('jS F Y') ?><br />
    FILED AS: <?php the_category(', ') ?><br />
    COMMENT FEED: <?php comments_rss_link('RSS 2.0'); ?><br />
    PREVIOUS: <?php previous_post('%', '', 'yes', 'yes'); ?><br />
    NEXT: <?php next_post('%', '', 'yes', 'yes'); ?>

    But again no Author Name, all other values were fine.

    So I need help with echoing the author name to the single post page please.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 4 years ago by matthewjepearson
  • This topic is not resolved
  • WordPress version: 2.9.2