Skip to content

Decide when, where, and to whom your content is visible.

Notifications You must be signed in to change notification settings

richardtape/content-visibility

Repository files navigation

Content Visibility

Decide when, where, and to whom to show each block on every page of your WordPress site.

Content Visibility provides a set of controls to say whether each discrete piece of content (or 'block' in WordPress parlance) should be shown to users who are signed in to your site or not. Additional add-ons provide controls for role-based visibility and time-based visibility.

Individual Block Controls

Every individual block on all posts and pages on your site can have their own controls. Mix and match the visibility of blocks on a single page. Need some blocks to show to everyone and a few to only be available to your site's subscribers? No problem. Only want a message to appear on Christmas Day? You got it. Only want those who are signed in to your site to see certain pieces of content? Easy peasy.

At a glance

An icon next to each block with active rules allows your content authors to see which blocks may or may not be shown to certain audiences at a glance.

Reusable blocks

Use Reusable Blocks? No problem, Content Visibility handles those too.

Show me the goodies!

Screenshot showing content visibility controls including the icon which allows content authors to see which of their blocks have content visibility rules in place

Columns and Nested Blocks

Do you use columns and put other blocks in them? Content Visibility allows you to control both the 'nested' blocks (such as a paragraph block in a column block) or the 'parent' block themselves (perhaps hide a column for users who aren't signed in). Other examples of nested blocks are the Group Block or if you use an accordion or tabs block; all work!

Coming Soon

  • A way to set replacement content when a block is hidden
  • REST API exploration. Should be fine for non-authenticated requests, but need to dive deeper for auth'd requests
  • Non-trivial dates. Think things like "Every Wednesday between 3pm and 4pm" or "First two weeks in November"
  • Geolocation: Show this block only to users whose connection is in France.
  • Specific Users: Only show a block when a specific user is signed in
  • Do you have any feature requests? Let me know!

Who made this?

My name's Rich Tape. Hi!

What's with the references to "Block Visibility" in the code?

As you can see I've had this repo online for quite some time. I've had the idea written down for much longer and a precursor to this plugin online since 2018. But, well, I'm slow. And because I'm slow, Nick Diego and Outermost Design beat me to the punch on the plugins repo. Nick's plugin is excellent and I'd highly recommend you check that out. I'm also encouraged to see that we've made several decisions that are very similar which means we're probably on to something.

I've changed the name of this plugin to Content Visibility, not just because I wanted to avoid a clash and subsequent confusion for our users, but also because I think it better reflects what this set of plugins does. They allow you to control the visibility of your content.

If you're seeing references to 'block visibility', it's likely I haven't migrated something over to the new name yet, I've missed something when renaming stuff, or maybe you're looking at the history of this repo (in which case please do not judge past me's code, it was likely even more terrible than code I wrote more recently).