Support » Fixing WordPress » How to enable custom field in metadata for 2.51

Viewing 3 replies - 1 through 3 (of 3 total)
  • Another day lost to hunting everywhere for this answer. Really, WordPress has terrible terrible support. I feel so sorry for new bloggers who think they can just jump into this.

    Anyway, let me try to help someone else. The page I linked to above in Codex doesn’t have this anywhere in the page. Yes, you can use the simple formula,
    <?php the_meta(); ?>
    by just putting it somewhere in your index page where the metadata is, and it works well. (I was wrong, didn’t think it would work!) However, it is ONLY in list form, with an indent and a bullet point. I couldn’t find any other templates anywhere, and I think it’s unlikely that the bullet point at the bottom of the post would match most themes. I didn’t want it like that.

    So here is exactly what I put in my index theme file:
    <ul class=”postmetadata”> <span class=’post-meta-key’>Weather:: <?php $key=Weather; echo get_post_meta($post->ID, ‘Weather’, true); ?> </span>

    That’s it. I put the postmetadata part in so the style would match the other metadata for my tags.

    I hope this helps someone else!

    PS. I should add that I cobbled this together from many different answers here on the forum.

    Just trial and error. There must be a better way to build a blog.

    I don’t know if you’re still searching for this but this might be useful to someone else as well; it essentially does the same thing as the_meta() but you can have a bit more control (like hiding some of the custom field or using keys and values in php):

        $keys = get_post_custom_keys($post->ID); 
        foreach($keys as $key) {
            $value = get_post_meta($post->ID, $key, 'true');
            if($key != "pp_item" AND $key!="currency" AND $key!="_edit_last" AND $key!="_edit_lock" AND $key!="_wp_page_template" AND $key!="email_item_name" && $key!="email_register_for_later") {
                if ($key=="pp_amount") $key = 'price';
                if ($key=="email_amount") $key= 'approximate price';
            echo "$key: <a href='?s=$value&key=$key'>$value</a><br />";

    and for the trial and error process: that’s what i’m doing each and every day, and i happen to like it a lot 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to enable custom field in metadata for 2.51’ is closed to new replies.