Skip to content

Instantly share code, notes, and snippets.

@barbwiredmedia
Last active December 21, 2015 13:19
Show Gist options
  • Save barbwiredmedia/6312326 to your computer and use it in GitHub Desktop.
Save barbwiredmedia/6312326 to your computer and use it in GitHub Desktop.
Wordpress - Functions: Calls a custom field
// Enamble Custom Field output in functions.php
function print_custom_field($custom_field) {
global $post;
$custom_field = get_post_meta($post->ID, $custom_field, true);
echo $custom_field;
}
// Prints function
<?php print_custom_field('{name}'); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment