Return to Snippet

Revision: 38552
at January 5, 2011 01:44 by raz


Initial Code
<?php $somevar = get_post_meta($post->ID, 'customfieldname', true);
	
	if($somevar) { 

	echo $somevar;
} else { 
	echo 'alternative text';
}?>

Initial URL
www.h3ostudio.com

Initial Description
This snippet check for custom field value (customfieldname), if there is nothing it will display  default value (alternative text).
This is my first WordPress Snippet :)

Initial Title
If custom field exists

Initial Tags
wordpress

Initial Language
PHP