我正在开发一个显示所有作者的函数,但似乎我做错了什么事情,直到页面底部与输出分离,其中的HTML才会显示出来。
/* 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>\';
if(userphoto_exists($author->ID))
echo userphoto($author->ID);
else
$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\');