I'm trying to display custom fields on my site , but unable to return any values in the front-end.
First I added this function to functions.php :
function get_custom_field($custom_field) {
global $post;
$custom_field = get_post_meta($post ->ID, custom_field, true) ;
return $custom_field ,
}
In my page.php I added this :
<?php if ( function_exists('get_custom_field') ) {
get_custom_field('distance', true) ;
} ?>
The "distance" field is the custom field that I created and want to be displayed.
Any direction would be great.