N
N
nulledbox2020-03-02 21:11:35
css
nulledbox, 2020-03-02 21:11:35

How to hide tags via Advanced Custom Fields?

Help me solve a problem that I've been struggling with for more than one day and finished off specifically Google's search history =)

In the template I use the code to display additional. ACF fields. I wrapped it with a tag for a nice design. If the field is not filled, it displays an empty colored square (css). What is the solution, if the FIELD is NOT FILLED, then the tags are hidden.

I use this:

<span class="acf-version">v.<?php the_field( 'fileversion' ); ?></span>


CMS DLE has a great solution for working with additional fields, you wrap them with [xfgiven_*] [/xfgiven_*] and everything inside is hidden if the field is empty.

For anyone, there is such a solution for Advanced Custom Fields

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
archelon, 2020-03-02
@archelon

answer in documentation
https://www.advancedcustomfields.com/resources/hid...

<?php if( get_field('fileversion') ): ?>
  <span class="acf-version">v.<?php the_field( 'fileversion' ); ?></span>
<?php endif; ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question