Support » Themes and Templates » Remove comma in custom field list

  • Resolved venkmanuk


    Hi there,

    I’m trying to remove the comma in a custom field list.

    at the moment it says:

    book 1, book 2

    i want it to say:

    book 1
    book 2

    so remove the comma and replace with a <br />
    what’s the code?


Viewing 6 replies - 1 through 6 (of 6 total)
  • This is an impossible question to answer, with only the information you’ve given.

    What Theme are you using? Is the Theme adding the custom field, or is a Plugin adding the custom field? If a Plugin, what Plugin?

    its a custom theme i’m building.

    the custom field information is coming from <?php the_meta(); ?>
    no plugins..

    thanks for checking.

    Then can you post the relevant code from your Theme into a pastebin?

    well, the code above is all i have.

    here’s a pastebin explanation:

    i think i need to build a function somehow / somewhere that edits what the output is. ?


    You probably need to create a function that customizes your output, using get_post_meta(), and then creating markup using your meta_key values.

    yeah, here’s the answer:

    you display the custom field as an array using get_post_meta and style the list. Here’s the example that explained it to me.. just paste this in your page.

    assuming the custom field is called “thanks”

    < ?php
    $thanks = get_post_meta($post->ID, 'thanks', false);
    if ($thanks) {
      echo "<h3>Special thanks to:</h3>\n<ul>";
      foreach ($thanks as $person) {
        echo "<li>".$person."</li>";
      echo "</ul>";

    credit goes here:

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove comma in custom field list’ is closed to new replies.