How to check if custom field from Types plugin exist
-
I’m using the types plugin for custom fields and I’ve would like to check if my custom field exist before posting it.
I’ve found this code, but don’t know how to use it (my php skills aren’t that good).
<?php //Check if custom field is empty if (!((get_post_meta($post->ID, 'wpcf-email', TRUE))=='')) { //Not empty echo get_post_meta($post->ID,'wpcf-email',TRUE); } ?>
My code looks like this today:
<div class="spotify"> <a href="<?php echo types_render_field("spotify-url", array("argument1"=>"value1","argument2"=>"value2","argument2"=>"value2")); ?>" target="_blank"><?php echo types_render_field("spotify-text", array("argument1"=>"value1","argument2"=>"value2","argument2"=>"value2")); ?></a> </div>
And I would like something like:
if spotify-url exist show
xxx-my-code-xxx
if not show
nothing.Any suggestions?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to check if custom field from Types plugin exist’ is closed to new replies.