Site logo

[Resolved] Hiding the heading title of a query block if empty

Home Forums Support [Resolved] Hiding the heading title of a query block if empty

Home Forums Support Hiding the heading title of a query block if empty

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #2593388
    qpaq

    Hi,

    How can I hide the heading title of a query block placed on the left sidebar, if the output is empty?

    And how can I make this block a sticky one so it stays the same place when scrolled up and down.

    #2593767
    Fernando
    Customer Support

    Hi Qpaq,

    Let’s address the first inquiry first regarding removing the title.

    Add the Headline Block after the Query Loop Block inside the Container Block.

    This will position the Headline after the Query Loop, but we will fix that with CSS.

    Add this through Appearance > Customize > Additional CSS:

    .gb-grid-wrapper.gb-grid-wrapper-450385a9.gb-query-loop-wrapper::empty + .gb-headline {
        display: none;
    }
    
    .gb-container.gb-container-3db058ea {
        display:flex;
        flex-direction:column-reverse;
    }
    #2594230
    qpaq

    I think I’m making something wrong as it didn’t yield a result even when the query result is empty.

    Screenshot

    #2594402
    David
    Staff
    Customer Support

    To hide the heading immediately after an empty query loop try this CSS:

    .gb-query-loop-wrapper:empty + .gb-headline {
        display: none !important;
    }
    #2594422
    qpaq

    Sorry, but that didn’t work out. Still seeing the heading even the query result is empty.

    #2594444
    David
    Staff
    Customer Support

    Where can i see the page with the empty query ?

    #2594532
    qpaq

    I’ve copied it to the private info box.

    #2594955
    Ying
    Staff
    Customer Support

    The headline is not after the query loop but before it, try this CSS instead:

    .gb-container:has(.gb-query-loop-wrapper:empty) {
        display: none;
    }
    #2595077
    qpaq

    Hi Ying,

    That didn’t work out either. Am I doing something wrong?

    #2595112
    Ying
    Staff
    Customer Support

    You’ve added it into a media query, so it only works on mobile currently.

    Try moving it out of the media query.

    #2595323
    qpaq

    Holy goat! Just saw the media query error. You’re a genius, now it works.

    #2596798
    Ying
    Staff
    Customer Support

    Haha glad to hear that 🙂

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