Home Forums Front-end Issues Display a group of fields with labels


Display a group of fields with labels

  • Hello

    I am trying to show a group of fields with their labels, but I am getting the field names instead. Also I would love to be able to style the label and the value separately, which means adding classes, unfortunately this is also outside my competence.

    And as a last thing, this spits out the field name and value on separate lines, which I also would like to prevent.

    Very thankful for any advice, this is the code I am using:

    $fields = get_fields();
    if( $fields ): ?>
    		<?php foreach( $fields as $label => $value ): ?>
    			<li><b><?php echo $label; ?></b> <?php echo $value; ?></li>
    		<?php endforeach; ?>
    <?php endif; ?>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.