Get Custom Field Values v3.3.2

I’d like to announce the official release of the updated Get Custom Field Values plugin (v3.3.2) for WordPress.

Use widgets, shortcodes, and/or template tags to easily retrieve and display custom field values for posts or pages.

Recommended bugfix update! Highlights: fixes bug in widget preventing proper display of custom field for current post; noted WP 3.3+ compatibility; and more.

For more details, instructions, screenshots, and the download link, visit the plugin’s official homepage at :
coffee2code.com/wp-plugins/get-custom-field-values/.

Comments are welcome on this post for this version of the plugin. Comments will be closed once this release has been superseded by another.

Read on for a detailed ChangeLog of the release.

Detailed ChangeLog

These are the detailed changes, which may or may not make sense to you depending on your familiarity with the previous features and internals of the plugin.

  • Fix bugs in widget preventing proper display of custom field for current post (props Ross Higgins)
  • Trim and/or intval widget input fields in validate()
  • For shortcode widget’s JS, output via ‘admin_print_footer_scripts’ instead of ‘admin_footer’
  • Note compatibility through WP 3.3
  • Add ‘Domain Path’ directive to top of main plugin file
  • Add link to plugin directory page to readme.txt
  • Update copyright date (2012)

Since I never made a post regarding v3.3 and v3.3.1, here’s the ChangeLog for those releases:

  • Modify c2c_get_random_custom() to support returning multiple random values (function now accepts additional arguments)
  • Fix fatal shortcode bug by updating widget framework to v005 to make a protected class variable public
  • Update widget version to 003
  • Rename widget class from ‘GetCustomWidget’ to ‘c2c_GetCustomWidget’
  • Enable shortcode support for custom field values
  • Update widget framework to v004
  • Document shortcode
  • Note compatibility through WP 3.2+
  • Minor code formatting changes (spacing)
  • Minor readme.txt formatting changes
  • Add plugin homepage and author links in description in readme.txt
  • Add .pot
  • Update copyright date (2011)

8 thoughts on “Get Custom Field Values v3.3.2

  1. Hello. How can I determine the order of the results if I’m not using the c2c_get_recent_custom() command? Or at least, can you tell me how the plugin is ordering them in the first place? I need the custom fields to be placed in a certain order, but even if I add them one by one in chronological order, the plugin spits them out in an order I cannot figure out.

    Thanks.

  2. Hi Zhiwan, it just so happens that I followed up to your post on the WP support forum moments before seeing your comment here. I’ll paste my response as well; feel free to continue the discussion in either place.

    The function c2c_get_current_custom() relies on WordPress’s get_post_custom_values() function. The latter performs a query without specifying an ORDER BY clause in the SQL, so the order of the data returned cannot be depended on (as you’ve noticed).

    Presumably you’d expect/prefer the custom field values to be ordered alphabetically?

    In thinking about it, it seems like it may be worthwhile for me to allow specifying an ‘order’ argument to a few of the functions. In the meantime, there isn’t a straightforward solution for you. Depending on where and how you’re using the function, you can invoke the output formatting function directly with the sorted custom field values.

    For example, Instead of something like this:

    echo c2c_get_current_custom( 'myfield', '', '', '', ', ' );

    You’d do:

    
    $cfvalues =  (array) get_post_custom_values( 'myfield', get_the_ID() );
    sort( $cfvalues );
    echo c2c__format_custom( 'myfield', $cfvalues, '', '', '', ', ' );
    

  3. When I try to activate the plugin, it tells me:

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in …/html/wp-content/plugins/get-custom-field-values/c2c-widget.php on line 17

    And when I look at my posts I see:

    Fatal error: Call to undefined function: c2c_get_custom() in …/html/wp-content/themes/newdesign/single.php on line 20

    (I just put in … to shorten the path) This is WordPress 3.0.1. It’s using PHP 4.4.9.

  4. Since upgrading to a newer version of WP’s backend (and I think of your widget) I have been stumped by how to use the interface for the widget on the post editor page… I generally need to be able to see the custom values listed after the post, and need to be able to add new ones without adding them into the text of the post itself (I end up displaying them in part of the template). Is there something I’m missing, and there’s still a way to do that that I’m just not seeing? My custom post values still appear to be showing up fine on gumbaby.com, so I know they’re there, I just can’t access them through the editor anymore. Any insight into this would be greatly appreciated.

  5. @Stewart: It may well be a PHP compatibility issue and/or compatibility issue with such an older version of WordPress. I guess technically I still have the plugin listed as compatible with WP 3.0.x, but my inclination would be to simply drop support for any WP version older than at least 3.1. I’d urge you to upgrade your WP to the latest if possible. In the meantime, if an older version of the plugin works for you, stick with that one

  6. @Gus: WP has recently hidden the custom fields meta box on the post editor page. The next time you’re editing or creating a post, click the “Screen Options” tab in the upper-right corner of the page. An options form will slide down. Check the checkbox for “Custom Fields” and you should be back in business.

Leave a Reply

Your email address will not be published.