WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Anyone using "Get Custom Field Values" plugin in WP2.2? (7 posts)

  1. helderluis
    Member
    Posted 7 years ago #

    Hi, i'm a long time fan of this plugin:
    http://www.coffee2code.com/archives/2004/06/30/plugin-get-custom/

    Recently i installed WP2.2 in a new site i'm starting and this plugin doesn't work...
    Anyone with the same problem? Got any solutions?

    Many thanks...

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    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);

  3. Dgold
    Member
    Posted 7 years ago #

    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.

  4. helderluis
    Member
    Posted 7 years ago #

    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.

  5. MichaelH
    Member
    Posted 7 years ago #

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

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

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    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.

  7. helderluis
    Member
    Posted 7 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic