Skip to content

Instantly share code, notes, and snippets.

@timnovinger
Created December 15, 2011 19:35
Show Gist options
  • Save timnovinger/1482486 to your computer and use it in GitHub Desktop.
Save timnovinger/1482486 to your computer and use it in GitHub Desktop.
Colorjar: Get custom field in WP
function custom_field($key) { echo get_custom_field($key); }
function get_custom_field($key, $echo = FALSE)
{
global $post;
$custom_field = get_post_meta($post->ID, $key, true);
if ($echo == FALSE) { return $custom_field; }
echo $custom_field;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment