Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author philbuchanan

    (@philbuchanan)

    I’m not sure I understand the purpose of such a feature. If the accordion is going to be empty, why include it at all?

    Thread Starter Stagger Lee

    (@stagger-lee)

    Imagine they are used as containers for: gallery, video, Google Map, Info, something-else, etc.. Data is provided by and via Advanced Custom Fields.

    And imagine some Posts wont have for example Google Map. Or Video, or something-else

    I am talking about hardcoding accordion shortcode in PHP template. Not using it via TinyMce.

    All of it is done, just wonder how difficult is to hide empty accordion shortcode.

    Plugin Author philbuchanan

    (@philbuchanan)

    If you’re coding them all with PHP and custom fields, why not just check for the existence of the custom field with something like this:

    <?php if ($custom_field) {
        // insert the accordion
     } ?>
    Thread Starter Stagger Lee

    (@stagger-lee)

    Ooo, thank you. So simple.

    Went crazy trying to make if conditional against repeater sub field. Then became aware I need only repeater field for this, not subfield.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Hide accordion "if empty" ?’ is closed to new replies.