Hide empty or unrelated Custom Fields when converting blocks to html

This topic contains 4 replies, has 2 voices, and was last updated by  Alex Rollin 4 years, 9 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #501961

    Tony Bellens
    Full Member
    Post count: 254

    Hi,

    I’m experimenting with the layout of the archive items and details pages. When adding shortcodes or block placeholders for the address, custom fields and so on, the fields that are empty or not used or not related to the CPT are not shown.

    Now if I convert these blocks to html to add them in a grid or a striped list, all fields are shown. I attached 3 screenshots to explain better what I mean.

    In the code for the archive items, all fields are shown for the places and the events. Noe for the events there are custom fields that I would like to hide for the places, like the venue name and the date/time of the event. At the moment, as you can see in the screenshot for the places, there are two empty spaces between the dividers.

    Is there a way/code to hide fields that are not filled in or related?

    Thank you,
    Tony

    #502030

    Alex Rollin
    Moderator
    Post count: 27815

    If the field has no value the widget will not render at all. However, your theme may add formatting like a border top and bottom to surrounding tags like an li or p tag. Those are not part of the block.

    #502031

    Tony Bellens
    Full Member
    Post count: 254

    Ok Alex, thanks. I’ll play around with it a bit more, see what works best.

    Regards,
    Tony

    #502267

    Tony Bellens
    Full Member
    Post count: 254

    All good Alex, figured it out. Thanks.

    #502335

    Alex Rollin
    Moderator
    Post count: 27815

    OK great!

Viewing 5 posts - 1 through 5 (of 5 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket