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.

Conditional Visibility

  • Drew McManus

    I want to be sure I’m not overlooking something but is there any way to set a block’s frontend visibility based on conditional elements such as a post’s taxonomy?

  • Hi there,

    If it’s a Hook element then you can use the Display Rules to control it:
    https://docs.generatepress.com/article/block-element-hook/

    Let me know if this helps 🙂

  • Drew McManus

    Hi Leo, I guess that could work. I was initially looking at this as finding a way to create a single Block Element set to show on a custom post type and individual content blocks would have the display rules.

    However, it sounds like you’re suggesting I create mutually exclusive Block Elements that only have the taxonomy based content block set to display in the custom post type with a taxonomy based display rule.

    If that’s correct, would this generate any additional query load by having a dozen different Block Elements with taxonomy based display rules as opposed to a single Block Element with display rules at the content block level?

  • I should mention that the hooks method would only work if your content is placed within the hook locations as there are no hooks inside the content itself:
    https://docs.generatepress.com/article/hooks-visual-guide/

    would this generate any additional query load by having a dozen different Block Elements with taxonomy based display rules as opposed to a single Block Element with display rules at the content block level?

    I’m not sure, unfortunately. You would need to test this out.

  • Drew McManus

    Acknowledged and thanks for the reminder. We’ll run some tests on our end to see if this approach has any adverse impact on page load speed.

  • No problem 🙂

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