WordPress.org

Support

Support » How-To and Troubleshooting » Quick Custom Fields Question

Quick Custom Fields Question

  • I would like to output the value of a custom field in my post. That field is called “vid_a” and its value is “something.swf”. I don’t want a list or anything… Just a simple raw output of the value.

    I’ve been trying to do this for WEEKS. I began with the function listed in the Codex: get_post_meta.

    But I must be using it wrong, because it doesn’t output anything. Any help would be appreciated. The more specific you can be – actual code would be excellent – the more it will help me. Thanks so much for taking the time.

    Sumeet

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try this (examle code within readme file)

    Plugin: Get Custom Field Values

    I just tried that before posting. It creates a lot of “cannot-modify-header” errors.

    Isn’t there a way to do this without a plugin?

    Just use
    <?php echo get_post_meta($post->ID, 'vid_a', true); ?>

    get_post_meta just retrieves the value. To output it, you’ll need to echo the value returned.

    BTW, as an aside, “cannot-modify-header” errors are usually due to extraneous whitespace.

    You’d better watch out, because if I ever find you I might not be able to control myself from giving you a series of embarrassing but curiously refreshing hugs.

    “You’d better watch out, because if I ever find you I might not be able to control myself from giving you a series of embarrassing but curiously refreshing hugs.”
    Erm, thanks?:)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Quick Custom Fields Question’ is closed to new replies.
Skip to toolbar