• Resolved HorrorUK

    (@horroruk)


    I’ve been working too long and my brain hurts, so if somebody could help me with this simple problem, that would be great.

    I have a section on my site with various information for events going on in my county. The main information is being added using custom fields so, for example, the town is a custom field and I just want it to simply print it out as it is typed in.

    I’m using the code below, but it doesn’t work. It shows the section on Town: in bold, but it doesn’t show the actual info.

    I have checked, and it is in the correct place in the post custom field.

    <?php if( get_post_meta($post->ID, "eventtown", true) ): ?>
    <b>Town: </b><?php echo $eventtown; ?>
    <br />
    <?php else: ?>
    <?php endif; ?>

    Here is the URL if it helps:
    http://inhampshire.net/2010/04/23/horror-uk

Viewing 2 replies - 1 through 2 (of 2 total)
  • are you trying to echo the custom field value?

    <?php if( get_post_meta($post->ID, "eventtown", true) ): ?>
    <b>Town: </b><?php echo get_post_meta($post->ID, "eventtown", true); ?>
    <br />
    <?php else: ?>
    <?php endif; ?>
    Thread Starter HorrorUK

    (@horroruk)

    Thanks, that’s exactly what I needed :o)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Simple custom field question’ is closed to new replies.