Support

Account

Home Forums Front-end Issues Displaying a title when a field is completed

Solved

Displaying a title when a field is completed

  • Hi everybody,

    First, thanks for this amazing plugin.
    Repeater add-on is dope !

    I would like to know if is it possible to display a title on my page,
    if and only if the field is completed.

    For example, we can imagine a ‘Credits’ field,
    which may be empty as optional,
    but when we set a value to it,
    a title will be displayed on the page.

    something like this
    <h2>Credits</h2>
    <h3>The Value</h3>

    Cheers from France !

  • I just tried with this

    <?php
     
    if(get_field('proj_annee'))
    {
    	echo '<h3>Année</h3>' . get_field('proj_annee');
    }
     
    ?>

    But the result of get_filed(‘proj_annee’) is ‘Array’

  • ok i got it

    <?php if( get_field('proj_annee') ): ?>
    	<h3>Année</h3> <?php the_field('proj_annee'); ?>
    <?php endif; ?>

    The answer was here :
    http://www.advancedcustomfields.com/resources/how-to/hiding-empty-fields/

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Displaying a title when a field is completed’ is closed to new replies.