Forums

custom meta fields (3 posts)

  1. pascaletrangmailcom
    Member
    Posted 5 years ago #

    this is probably a really simple question buti can't seem to get it to work as i'm not that familiar with php.

    i have three custom fields that i want to display the values of but not the keys. the three keys are date, artist and description. the values would display on the single post page only.
    i was trying to use <?php get_post_custom_values(); ?> but nothng is showing up.

    when is use <?php the_meta(); ?> the keys and the values both show up but i don't want the keys.

    can someone tell me what the write code is that i should be dropping into my single.php template? sorry am such a programming retard..

  2. Otto
    Tech Ninja
    Posted 5 years ago #

    Like this?

    <?php
    echo get_post_custom_values('date');
    echo get_post_custom_values('artist');
    echo get_post_custom_values('description');
    ?>

    Or perhaps this?

    <?php
    echo get_post_meta($post->ID, 'date', true);
    echo get_post_meta($post->ID, 'artist', true);
    echo get_post_meta($post->ID, 'description', true);
    ?>

    How you do it depends on what you're doing. Might want to read up here:
    http://codex.wordpress.org/Using_Custom_Fields

  3. pascaletrangmailcom
    Member
    Posted 5 years ago #

    perfect.. thank you so much!

Topic Closed

This topic has been closed to new replies.

About this Topic