Home › Forums › General Issues › Shortcode: Using the Hide if empty in a shortcode › Reply To: Shortcode: Using the Hide if empty in a shortcode
Two other options that would be awesome is to add html wrapper and class
[acf field="field_name" post_id="options" hide_empty="1" html_tag="div" class="my-class"]
This would output
<div class="my-class">Field Value</div>
If no value then output nothing.
If class exists but not html tag then default to <span>
This would be really awesome as options to the ACF standard shortcode.
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.