Forums

Adding Custom Fields (5 posts)

  1. mikem1986
    Member
    Posted 3 years ago #

    Hi guys
    Could you take a look at the css of this

    http://www.gigflick.co.uk/2009/05/taking-back-sunday/

    in the section which shows

    Posted on: May 13, 2009
    Comment on This Video
    Share This Video
    Embed This Video

    I want to some sections such as Date Taken and Venue and City so it looks like this

    Posted on: May 13, 2009
    Date Taken: Example
    Venue: Example
    City: Example
    Comment on This Video
    Share This Video
    Embed This Video

    I know you can do this by custom fields, i can create them fine etc but what do i need to add into single.php to get this to work?

    Thanks

  2. mikem1986
    Member
    Posted 3 years ago #

    PS: ive tried following the instructions on WP Codex but cant get my head round it

  3. mikem1986
    Member
    Posted 3 years ago #

    anyone?

  4. mikem1986
    Member
    Posted 3 years ago #

    ive tried using

    <?php the_meta(); ?>

    but this brings in all my custom fields so it adds the images and thumbnails when i only want venue, city and date

    Ive also tried echoing with

    <p class="itemlinks">Venue: <? echo get_post_meta($post_id, 'venue', true); ?>
    <p class="itemlinks">Date: <? echo get_post_meta($post_id, 'date:', true); ?>
    <p class="itemlinks">City: <? echo get_post_meta($post_id, 'city', true); ?>

    this then just doesnt show the information?

    where am i going wrong?

  5. mikem1986
    Member
    Posted 3 years ago #

    Sorted it

    <p class="itemlinks">date: <?php $key="date"; echo stripslashes(get_post_meta($post->ID, $key, true)); ?> </p>

    <p class="itemlinks">Venue: <?php $key="venue"; echo stripslashes(get_post_meta($post->ID, $key, true)); ?> </p>

    <p class="itemlinks">city: <?php $key="city"; echo stripslashes(get_post_meta($post->ID, $key, true)); ?> </p>

Topic Closed

This topic has been closed to new replies.

About this Topic