Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Check “hide on desktop” but don’t hide on the back end?

  • Hi,
    I have a few Generateblocks Container blocks/patterns which will mostly be showing but occasionally need to be hidden/removed. For example, my client will often have an upcoming event to promote, so I created a Container that has all the necessary elements for that (and made a block pattern from it). During the occasional periods when they don’t have anything upcoming, I’d like to leave the block where it is on the Events page and simply hide it on the front end by checking off all of: hide on desktop, hide on tablet, hide on mobile. That works fine for hiding it, but it also causes all of the content to disappear on the back end. So unless you know top open the list view, find exactly the right block, and uncheck “hide on desktop”, you wouldn’t even know there’s a block there at all.

    I may be hallucinating but I feel like it didn’t used to work that way? At any rate, imo it would be far more user friendly if the hidden block were displayed but marked on the back end — something like an outline, background color, or have the whole thing greyed out, etc. I created block patterns so my client could easily update things themselves, and I don’t want them inadvertently adding multiple copies of this block because they forget to open list view and check for invisible blocks.

    So my question is, is it supposed to work like that? And if so, is there any chance you’d consider changing it so the “hide on” toggles don’t completely hide the block in the editor?
    Thanks!

  • Hi there,

    The default behavior for the hide-on-* visibility is to always hide the element in the block editor as well; it has always worked that way. Unfortunately, at the moment, there are no controls or indicators to show which blocks have been hidden on the backend.

    However, considering your use case, it might be better to use a plugin like Block Visibility. It’s more robust and allows you to configure specific blocks to be hidden based on conditions, such as the occasional periods you mentioned in your explanation.

  • Thanks for the response! I’ll try that plugin — I was hoping I could use the function already built into Generateblocks so as to not add another plugin, but a timing option might actually be really useful. Appreciate the recommendation.

  • You can also manully add hide-on-* class to the block, this way it will not hide the element in the editor.

    This is how you add classes to blocsk: https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/

  • Thanks! That might be a touch advanced for client use but it’s a good workaround to know about.

  • You are welcome   🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.