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 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.