WordPress.org

Support

Support » How-To and Troubleshooting » the_author() displays twice

the_author() displays twice

  • Using the following code:

    <?php
    	$mymood=get_post_meta($post->ID, "Mood", $single=true);
    	if(strlen($mymood)>0)
    	{
    		echo "<span>". the_author() ." was <strong>".get_post_meta($post->ID, "Mood", $single=true)."</strong> when he wrote this post</span><br />";
    	}
    ?>

    … the author name displays twice. The blog has only one author.

Viewing 1 replies (of 1 total)
  • You want to change “the_author()” in your echo into “get_the_author()”, because the_author() itself displays the author’s name, while get_the_author() just returns the value.

Viewing 1 replies (of 1 total)
  • The topic ‘the_author() displays twice’ is closed to new replies.