Created
June 11, 2014 21:29
-
-
Save yellowberri-snippets/7d3d7946ed0204d3bd48 to your computer and use it in GitHub Desktop.
PHP: WP: Display Multiple ACF Fields with Custom Label
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$listedInfo = array( | |
'client' => 'Client', | |
'city' => 'Location', | |
'date' => 'Project Date', | |
'cost' => 'Construction Cost', | |
'size' => 'Building Size', | |
'schedule' => 'Construction Schedule' | |
); | |
foreach ($listedInfo as $fieldName => $displayName) : | |
if ( get_field( $fieldName ) ) : | |
echo '<span class="listed-data">'; | |
echo '<strong>' . $displayName . ":</strong> " . get_field($fieldName); | |
echo '</span>'; | |
endif; | |
endforeach; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment