As WordPress itself is very powerful concerning permission management, it’s sometimes a little bit difficult to perform very simple tasks. Recently I wanted to display different contents for different users (or more specifically: different user roles). However this isn’t possible to do out of the box.
There are a lot of plugins for managing user groups (or here) and even build big membership systems. But this seemed like a complete overkill for what I wanted to do. So I wrote a small shortcode that could do exactly that.
The usage is simple: an enclosing shortcode named [user_role] will take the attribute of role=”role“; the content between opening and closing shortcode brackets will only be shown to those users who have the appropriate role specified in the attribute.