• I have some php that I run in a php sidebar widget. It’s getting along well with the custom field feature

    I have this in my functions.php file

    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;
    }

    Then use this to get the key value

    $_REQUEST['my_search'] = get_custom_field_value('my-key', false);

    But now I would like to have some default value set if there is not a value for the key on a given page.

Viewing 1 replies (of 1 total)
  • Thread Starter jazzylee77

    (@jazzylee77)

    I ended up installing widget logic and limiting the appearance of this php widget. Works for now.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom field – setting a default value’ is closed to new replies.