Created
June 17, 2011 02:37
-
-
Save ascott/1030750 to your computer and use it in GitHub Desktop.
wordpress - add a class to an element if user is admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
get_currentuserinfo(); | |
//add_users is a capability only admins have - http://codex.wordpress.org/Roles_and_Capabilities#Administrator | |
if (!current_user_can( 'add_users' )) { | |
//set admin class | |
$adminclass = 'is_admin'; | |
} | |
else { | |
$adminclass = ''; | |
} | |
?> | |
<div class="<?php echo $adminclass; ?>">comment stuff</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment