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 query loop

  • It’s possible to create a conditional query loop. For example: I want to make it so this block isn’t displayed or only shows up when I have a post, for example from a specific category, but instead not show the entire block on the page. Is this possible using the native generateblock features? Thanks.

  • Hi there,

    I’m not quite sure I fully understand your requirement. Could you elaborate a bit more, or if possible, provide some real-life use case examples?

  • If you’re sorry, I didn’t explain myself well; it’s not my language. Example: (capture) this news item, from 1 post. I want to highlight it only when that event is promoted. I’ll highlight it with some taxonomy or possibly “fixed” it. The question is: Can I not show this block with some conditional option? When there is no highlighted news item with the corresponding taxonomy? That is, when there is no fixed news item, only the 2 news items below will appear in the view. Is this possible, WITHOUT having to go into the block editor and hide the visibility. I want this element to hide automatically without the user having to intervene in the design.

    https://ibb.co/wNsRR9PT

  • You should be able to assign a taxonomy term to the query block, if there are no posts with that term, then it won’t show.

    Select the query block, add taxonomy parameter, and select a term.

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