/ Published in: PHP
                    
                                        
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 :)
                This is my first WordPress Snippet :)
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<?php $somevar = get_post_meta($post->ID, 'customfieldname', true);
if($somevar) {
echo $somevar;
} else {
echo 'alternative text';
}?>
URL: www.h3ostudio.com
Comments
 Subscribe to comments
                    Subscribe to comments
                
                