• Resolved ankitshekhawat

    (@ankitshekhawat)


    It may be more of a php question but is there a way we can change comma separated values from a custom field entries like
    apples, oranges, bannanas

    to

    <li>apples</li>
    <li>oranges</li>
    <li>bannanas</li>

    Any help is much appreciated.

Viewing 1 replies (of 1 total)
  • <?php
    $string = get_post_meta($post->postID, 'CustomFieldName', true);
    $values = explode(',', $string);
    foreach ($values as $value) {
       echo '<li>' . $value . "</li>\n";
    }
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘How to turn comma separeted values in a custom fields to <li>’ is closed to new replies.