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.

Only Edit One Grid Item

  • Hello,
    I have a grid/query loop at the top of this page under “top bakeries in & around Lancaster, PA”: https://www.lanclocal.com/lancaster-pa/bakeries/
    I’d like to update only one business to have content pull in under “what locals love.” Is there a way to only update one item from the grid (so that I could “what locals love” to the first one and not to the other three) OR is there a way to have a block like “what locals love” to disappear if another block in the same post template is empty?
    Thanks!

  • Hi there,

    a way to have a block like “what locals love” to disappear if another block in the same post template is empty

    this could be possible with some simple CSS.

    For example:

    
    Container Block #1 with a CSS class of: <code>may-have-dynamic</code>
    ---- Heading "what locals love"
    ---- Heading dynamic data with a CSS class of: <code>is-dynamic</code>
    

    Then you can use the :has() relational pseudo-class in some CSS eg.

    
    .may-have-dynamic {
        display: none;
    }
    .may-have-dynamic:has(.is-dynamic) {
        display: block;
    }
    

    This will show the may-have-dynamic container if it contains is-dynamic elements.

    Alternatively we could look at a PHP method to remove blocks based on some condition, eg. the existence of a custom field value or maybe a post count in the loop.

    Let me know

  • Thank you!

  • You’re welcome

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