WordPress tutorial for, wordpress get post meta custom post type smartly. The get_post_meta method is very useful in wordpress. here is simple code snippet.
wordpress get post meta custom post type
If you want to shorthand the get_post_meta call for the current post then you can use following:
you can use above method through functions.php file. You need to put following code in file:
function get_current_post_meta($key,$postID=null){ if(empty($postID)) { global $post; return get_post_meta($post->ID,$key,true); } else { return get_post_meta($postID,$key,true); } }
and you can call it like this:
echo get_current_post_meta('custom_tags');
Using above method you can pass the post id also.