Support

Account

Home Forums General Issues Shortcode: Using the Hide if empty in a shortcode Reply To: Shortcode: Using the Hide if empty in a shortcode

  • Rather than remembering to use another shortcode just add options to acf standard shortcode. If the option hide_empty doesn’t exist then nothing. That’s simple.

    [acf field="field_name" post_id="options" hide_empty="1"]

    This seems simple and I would venture to say many of your users already want this.

    My code had a typo because I was not used to the new shortcode

    [acf_if_value=”gv_address_2″ post_id=”options”]

    Should have been

    [acf_if_value field="gv_address_2" post_id="options"]

    I probably would not have screwed this up if it were…

    [acf field="field_name" post_id="options" hide_empty="1"]

    Regrading wrapper html and class, if the options in the shortcode don’t exist, then nothing.

    You already add separate wrapper class to style the backend admin site. When I first used ACF I thought that was what It was going to do, output to the page. Instead it was admin backend styling.

    John, I heard your a wizard, could you provide hide_empty=”1″ code?

    – Please 🙂