【发布时间】:2017-03-26 10:48:36
【问题描述】:
是否可以向不同角色的用户显示不同的帖子?我需要这样的东西
用户 A => 发布 A ||
用户 B => 帖子 B
我不能使用 UserID,因为会有很多用户。我在想这样的事情
<?php
if ( is_userA_logged_in() ) {
echo 'Welcome A user!'; //here comes the query
} elseif ( is_userB_logged_in() ) {
echo 'Welcome B user!'; // here comes the query
}
?>
我正在阅读法典,但我只找到了is_admin(),我该如何调用新角色?
我会在 functions.php 中创建新角色
<?php
add_role('userA', 'User A', array(
'read' => true, // True allows that capability
'edit_posts' => false,
'delete_posts' => false, // Use false to explicitly deny
));?>
【问题讨论】:
标签: wordpress-theming wordpress