get_post_meta and displaying string once
-
Hello,
To be explicit, here is my code.<?php global $meta_box, $post; foreach ($meta_box['fields'] as $field) { $check = get_post_meta( $post->ID, $field['id'], true ); $output = ''; if ( ($check == 'on' ) ) { $output .= 'text: ' . $field['name'] ; $output .= '<br />' ; } echo $output; } ; ?>
Actually works fine. The result is:
text: result1
text: result2
in case I have 2 boxes checked.Now, I would like to have:
text: result1, result2
I can see two issues:
– first, the coma to avoid at the end of the string. I precise that implode doesn’t work at all
– and I am unable to find out a way to display “text:” only once.Is anybody can help, would be much appreciated.
Thx in advance.
Mad.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get_post_meta and displaying string once’ is closed to new replies.