How to display multiple custom field values

WooCommerce Review - add new product

Adding this snippet within the loop of your wordpress theme will let you display multiple instances of a custom field value.

( example screenshot )

$press_quotes = get_post_meta($post->ID, "pressquote", false);
if ($press_quotes[0]=="") { ?>

<!-- If there are no custom fields, show nothing -->

<?php } else { ?>

	<h3>From the Press</h3>

	<?php foreach($press_quotes as $press_quotes) {
	echo '<blockquote><p>'.$press_quotes.'</p></blockquote>';
	} ?>


<?php } ?>

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!