Show category posts in if user role.
-
I am trying to show the last two posts from a category on a page if the user is in a certain role.
I have started with the following code, but it doesn’t seem to work. What do I need to change?
<?php $user_roles = $current_user->roles; $user_role = array_shift($user_roles); if ($user_role == 'administrator') { query_posts('cat=11334&showposts=2'); while (have_posts()) : the_post(); ?> <h4><?php the_title(); ?> </a></h4> <?php the_content(); ?> <hr> } else { echo 'Hello'; endwhile; endif; }?>
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Show category posts in if user role.’ is closed to new replies.