Printing multiple values from a specific custom field inside loop
Description
This code will print all the custom field values of a specific custom field. For example if project banner custom field has 3 values then all three values will be printed. To use this code place it inside the loop and change “projectbanner” to the name of the custom field. Also dont forget to adjust […]
This code will print all the custom field values of a specific custom field. For example if project banner custom field has 3 values then all three values will be printed. To use this code place it inside the loop and change “projectbanner” to the name of the custom field. Also dont forget to adjust the div html
HTML Source Code
<!-------Start--------->
<?php $allmeta = get_post_meta($post->ID, 'projectbanner', false); ?>
<?php foreach($allmeta as $allmeta) { echo '<div class="post-thumb">'.$allmeta.'</div>'; } ?>
<!-------End--------->