我使用以下代码在模板上显示我的用户
<?php
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$paged -= 1;
$limit = 100;
$offset = $paged * $limit;
$args = array(
\'number\' => $limit,
\'offset\' => $offset,
\'role\' => \'editor\',
);
global $wp_query;
$wp_query = new WP_User_Query($args);
// Get the results
$authors = $wp_query->get_results();
foreach($authors as $author) :
echo $author->description;
endforeach;
?>
它工作得非常好,但是我还想显示我使用插件高级自定义字段创建的自定义字段。我已经设法在作者身上做到了这一点。包含以下代码的php页面:
$author_id2 = get_the_author_meta( \'ID\' );
$author_badge = get_field(\'profile_picture\', \'user_\'. $author_id2 ); // image field, return type = "Image Object"
<img src="<?php echo $author_badge; ?>" alt="<?php echo $author_badge[\'alt\']; ?>" class="alignright" />
但我不确定如何在WP\\u User\\u查询中显示相同的字段。任何提示都将不胜感激