Get Custom Field Values
Unzip get-custom.zip inside the /wp-content/plugins/ directory, or upload get-custom.php to /wp-content/plugins/
(optional) Add filters for ‘the_meta’ to filter custom field data (see the end of the plugin file for commented out samples you may wish to include). And/or add per-meta filters by hooking ‘the_meta_$field’
Activate the plugin through the ‘Plugins’ admin menu in WordPress
Give post(s) a custom field with a value.
(optional) Go to the Appearance -> Widgets admin page to create one or more ‘Get Custom Field’ sidebar widgets for your widget-enabled theme.
(optional) Use one of the six template functions provided by this plugin to retrieve the contents of custom fields. You must ‘echo’ the result if you wish to display the value on your site.
I added the template tag to my template and the post has the custom field I’m asking for but I don’t see anything about it on the page; what gives?
Did you echo the return value of the function, e.g. <?php echo c2c_get_custom(‘mood’, ‘My mood: ‘); ?>
Can I achieve all the functionality allowed by the six template functions using the widget?
Except for c2c_get_custom() (which is only available inside “the loop”), yes, by carefully setting the appropriate settings for the widget.
How do I configure the widget to match up with the template functions?
c2c_get_custom() : not achievable via the widget
c2c_get_current_custom() : set the “Post ID” field to 0, leave “Pick random value?” unchecked, and set other values as desired.
c2c_get_post_custom() : set the “Post ID” field to the ID of the post you want to reference and set other values as desired.
c2c_get_random_custom() : leave “Post ID” blank, check “Pick random value?”, and set other values as desired.
c2c_get_random_post_custom() : set the “Post ID” field to the ID of the post you want to reference, check “Pick random value?”, and set other values as desired.
c2c_get_recent_custom() : leave “Post ID” blank, leave “Pick random value?” unchecked, and set other values as desired.
I don’t plan on using the shortcode builder when writing or editing a post or page, so how do I get rid of it?
When on the write or edit admin pages for a page or post, find the “Screen Options” link near the upper right-hand corner of the page. Clicking it slides down a panel of options. In the “Show on screen” section, uncheck the checkbox labeled “Get Custom Field Values – Shortcode”. This must be done separately for posts and for pages if you want the shortcode builder disabled for both sections.
No comments yet.