WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a function that displays all authors but it appears I am doing something wrong the HTML within does not display until the bottom of the page separate from the output.

/* Add shortcode to display authors */
function all_authors() {
global $wpdb;

$authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users where ID not in(1)");

$retval = '<div id="author_list"><ul>';
foreach($authors as $author) {
$retval .= '<li>';
    echo userphoto($author->ID);
$retval .= get_avatar($author->ID, 96);
$retval .= '<h6>'.the_author_meta('display_name', $author->ID).', '.the_author_meta('tagline', $author->ID);
$retval .= '</h6><p>'.the_author_meta('description', $author->ID).'</p><p><strong>'.the_author_meta('phone', $author->ID);
$retval .= ' | <a href="'.the_author_meta('user_url', $author->ID).'" target="_blank">'.the_author_meta('user_url', $author->ID).'</a></strong></p></li>';
$retval .= '</ul></div>';
return $retval;

add_shortcode('myauthorbox', 'all_authors');
share|improve this question
Where do you initiate the function? Is it loaded in the theme setup step or after or before? – petermolnar Apr 4 '11 at 7:05
up vote 1 down vote accepted

the_author_meta() is display function, it echoes the result to screen right where it's called. To concatenate with string you need to use function that returns result - get_the_author_meta().

share|improve this answer
Thank you so much! – Gregg Franklin Apr 4 '11 at 13:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.