Skip to main content
3 of 11
added 61 characters in body
Dealazer
  • 57
  • 1
  • 2

The correct answers to the above solution-question are:

As "wp_get_current_user" only is available for logged in users.

<?php if(wp_get_current_user('editor')) || (wp_get_current_user('administrator') { ?> 
<!-- Stuff here for editors or administrators -->
<?php } ?>

If you have a special plugin that gives multiple roles to users?

<?php if(wp_get_current_user('author','editor')) { ?>
<!-- Stuff here for author and editor -->
<?php } ?>

If you want to see if the current user is either editor or administrator

if(wp_get_current_user('administrator')) { 
<!-- We identified the administrator -->
        }
else { 
        if(wp_get_current_user('author')) { 
?>
<!-- We identified the logged in user as author since we already know the 
admin that is now logged in can't read this code -->

// Stuff here for authors 
echo '<center>Welcome Author</center>';
?>
<style type="text/css">#divyouwanttoremove{
display:none;
</style>
<?php
}
}
Dealazer
  • 57
  • 1
  • 2