【发布时间】:2014-10-23 07:35:46
【问题描述】:
我想在循环中包含一个过滤器,因此只有具有特定用户角色的作者的帖子才会出现。我想在某个类别中展示它们,例如“经过验证的作者”,所以我还需要检查这是否是循环中的正确类别。
这是我得到的:
functions.php
function get_author_role()
{
global $authordata;
$author_roles = $authordata->roles;
$author_role = array_shift($author_roles);
return $author_role;
}
类别模板中的循环
<?php
if(have_posts()) : while(have_posts()) : the_post();
//how to check if author = specific role and check if category 'verifiedauthors" ?
endwhile;endif;
?>
【问题讨论】:
-
对不起,我的意思是创建的用户角色