2011-11-17 42 views
1

是否可以向不同角色顯示不同帖子用戶?我需要像這樣的東西向WordPress中不同角色用戶查詢帖子

用戶A =>發佈A ||

用戶B =>郵政乙

我不能使用用戶名,因爲會有大量的用戶。我想這樣的事情

<?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 
));?> 

回答