mercredi 26 octobre 2016

Advanced Custom Fields - display label and value only if value entered

i currently have the following:

<?php

$field_name = "text_field";
$field = get_field_object($field_name);   

if( $field ): ?> 

<table>
    <tbody>
        <tr>
            <th><?php echo $field['label']; ?></th>
            <td><?php echo $field['value']; ?></td>
        </tr>
    </tbody>
</table>

<?php endif; ?>

my goal is to make the entire table row collapse and not display if there is no value entered.

clearly a novice. thanks for taking a look.

Aucun commentaire:

Enregistrer un commentaire