Site logo

[Support request] Hiding empty Custom Field AND associated BLOCK Element Template Information

Home Forums Support [Support request] Hiding empty Custom Field AND associated BLOCK Element Template Information

Home Forums Support Hiding empty Custom Field AND associated BLOCK Element Template Information

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2459352
    Tom

    I have Custom Fields associated with a Custom Post Type. My CPT is “Positions’ as in Job Positions.
    Not all Custom Fields are required – this is by design as different positions require different fields.

    I have created a Block Template to display the custom fields in my CPT.

    All fields are present in my Block Template. I also created Labels for each custom field result, i.e.:
    Label 1
    Label 1’s associated Custom Field.

    Label 2
    Label 2’s associated Custom Field.
    and so on…

    However – Since not all custom fields are required – if they are not filled in – they do not appear.
    But the Labels still do – which are manually generated in my block template for each field.

    Is there a way to HIDE the labels if there is no custom field information present?
    (I could not find a way to pass Custom Field Label through to the front end – which would negate the need for generating labels in the block template.

    Thank you!

    https://imgur.com/a/JyfPRKt

    #2459420
    David
    Staff
    Customer Support

    Hi there,

    So in Block elements the Container Block has a special function in its Layout settings called: REMOVE CONTAINER CONDITION.
    You can set it to No Post Meta and set the Field name.
    Then you can add any associated blocks inside that.

    Its something we will add to GB Pro in the future 🙂

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