If a post, page, or another piece of content has been restricted with Restrict Content Pro, then extra HTML classes will be added via the post_class filter. In order for them to appear, your theme must be using the post_class() function in your template.
These classes can be used to style the restricted content differently. Here's a list of the classes that may be added:
rcp-is-restricted
- Is added to any post/page/etc. that has restriction settings.rcp-can-access
- Is added if the content has been restricted and the currently logged in user has access to view it.rcp-no-access
- Is added if the content has been restricted and the currently logged in user does not have access to view it.
Here's an example for adding a Font Awesome padlock icon in front of restricted content in the Twenty Sixteen theme:
.rcp-no-access .entry-title:before { content: '\f023'; font-family: FontAwesome; margin-right: 15px; }
The icon should appear for anyone who doesn't have access to view the restricted content.
With a bit more code, you can even unlock the padlock for someone who does have access:
// Default to the closed padlock for all restricted content. .rcp-is-restricted .entry-title:before { content: '\f023'; font-family: FontAwesome; margin-right: 15px; } // Override to show the unlocked icon if the user has access. .rcp-can-access .entry-title:before { content: '\f09c'; }
Note: The Font Awesome stylesheet needs to be added to your site separately.