Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    What does that plugin do? It looks like it just echo’s custom field values, in which case I’d wonder why not just use the built in functions for that purpose:
    http://codex.wordpress.org/Using_Custom_Fields

    Example:
    echo get_post_meta($post->ID, 'some-key', true);

    I’d be interested in hearing your results because I use Get Custom Fields on a site that’s still running WP 2.0.x which plans to upgrade to 2.2. I might try it and see in the next week.

    Thread Starter helderluis

    (@helderluis)

    Otto42, the problem with get_post_meta is that you have to use it inside the loop (as far as i know), not the case with this plugin. and it helps a lot, trust me.

    This in a Version 2.2.1 sidebar.php displayed the intended value

    <?php echo c2c_get_recent_custom('priceitem1'); ?>

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    the problem with get_post_meta is that you have to use it inside the loop (as far as i know)

    False. get_post_meta takes a post ID as a parameter, and so can be used anywhere. As long as you specify which post ID you want meta information for.

    Similarly, all the other functions like get_post_custom and such, have an optional post id parameter. Specify the post ID and they work outside the Loop too. In the case of these functions, they’ll work inside the Loop if you don’t specify a specific post, as they’ll use the current post ID.

    There’s no reason to use a plugin that I can see, when the functions are all right there anyway. All that plugin really does is to do the echo’ing of before and after bits for you. And that sorta seems overly complicated to me. Not to mention that the plugin is making its own database calls instead of using the postmeta_cache, which means that the plugin will actually be slower and add more load on the database than the built in code will.

    Thread Starter helderluis

    (@helderluis)

    Otto42, you’re right, never though of it in that way… You’re a genius!!!
    Thanks a million, works like a charm… no more plugins for this ; )

    Thanks everyone who joined this topic.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Anyone using “Get Custom Field Values” plugin in WP2.2?’ is closed to new replies.