Return to Snippet

Revision: 56789
at April 15, 2012 20:15 by paul0078


Initial Code
// place following function inside functions.php
function get_custom_field_value($szKey, $bPrint = false) {
        global $post;
        $szValue = get_post_meta($post->ID, $szKey, true);
        if ( $bPrint == false ) return $szValue; else echo $szValue;
}
 
// use following code to call function after checking that it exists
<?php if ( function_exists('get_custom_field_value') ){
        get_custom_field_value('home heading', true);
} ?>

Initial URL


Initial Description


Initial Title
Function to get custom field data

Initial Tags
wordpress

Initial Language
PHP