• Resolved Treebeard

    (@malawimama)


    I need to show a custom field in posts, with some text before it, but I don’t want to show the text if the custom field is empty. I tried some code from wprecipes but it was showing the text before it even when the field wasn’t added, then I checked the Docs but it was too confusing because it doesn’t mention how to add echo ‘some text here’ before the field values.

    I need to somehow detect if the field is added and only show that text if it’s added to the post, and if not, then hide that text.

    For instance, I want to add “First published in Some Publication Name Jan 2010

    I wanted to create a custom field value key named ‘publication’ where the text ‘First Published in’ is automatically populated so the admin doesn’t have to add that to the value box. I was thinking of adding echo ‘First published in’; to the code in the Loop somehow.

    Does anyone know of any tutorials or code that I can use in the latest version of WP?

    Thanks!~

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Field Value only if populated’ is closed to new replies.