Function to retrieve custom field values

/ Published in: PHP
Save to your folder(s)

Copy this code and paste it in your HTML
  1. // Get custom field values for easy use later
  2. function get_custom_field_value($szKey, $bPrint = false) {
  3. global $post;
  4. $szValue = get_post_meta($post->ID, $szKey, true);
  5. if ( $bPrint == false ) return $szValue; else echo $szValue;
  6. }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.