Discover with this tutorial how to display in black and white the entries that the Restrict Content Pro subscriber does not have access to, with a simple code snippet.
Restrict Content Pro is one of the most popular plugins to create memberships, that’s why in OsomCode you have a lot of tutorials (35) to customize it.
In some cases you may be interested in hiding posts that a subscriber does not have access to (if there is more than one membership level or content is released over time). Another option is to show them so they know “what they are missing out” but give them a visual clue of what they do not have access.
So, in this tutorial you are going to see how to display the posts, using the query loop block, that the user does not have access to with a black and white filter.
Let’s get started.
Snippet to display the entries that a subscriber does not have access to in black and white
Add the following snippet to the end of the style.css file:
To see this and another 1097 code snippets of this website, login or subscribe here.
/* Show posts you don't have access to in black and white */
.wp-block-post.rcp-is-restricted.rcp-no-access {
filter: grayscale();
}
[/restricted]
With these CSS lines you get to add a black and white filter to the posts that the subscriber does not have access to.
Conclusion
You now know how to add a black and white filter to posts that a Restrict Content Pro subscriber does not have access to, with a few lines of code.
Any questions? I read you in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉