WordPress.org

Ready to get started?Download WordPress

Forums

the_author() displays twice (2 posts)

  1. wonkotsane
    Member
    Posted 6 years ago #

    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.

  2. Sivar
    Member
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags