Seperate multiple values in get_post_meta with commas…
-
I’m trying to modify my posts by inserting metadata from my custom fields into my posts template. I’ve got everything working, but I’m having trouble figuring out how to separate multiple values with a comma WITHOUT the last value also having a comma after it. My code looks like something like this:
<?php $keys = get_post_meta($post->ID, 'keys', false); ?> <b>Key:</b> <?php foreach($keys as $key) { echo ''.$key.', '; } ?>
The output looks something like:
Key: value #1, value #2, value #3,
and I want to remove the “, ” after value #3…..
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Seperate multiple values in get_post_meta with commas…’ is closed to new replies.