I am trying to create a conditional that echoes something when a custom field is not “empty” (contains something)
The following is what I want to “echo”:
<div>Who is there?: <?php echo genesis_get_custom_field('FOO'); ?></div>
Which properly results in:
A) “Who is there?:” (when FOO is “empty”)
B) “Who is there?: Me” (when FOO contains “Me”)
When I add the following suggested conditional:
<?php if ( genesis_custom_field('FOO') != "") { ?>
<div>Who is there?: <?php echo genesis_get_custom_field('FOO'); ?></div>)
<?php } ?>
The result is “NULL” as expected when FOO is “empty”
BUT, when FOO = “Me” the resulting echo is:
“Me” (all “html” is stripped away including the DIV)
I am sure there is a “simple” syntax problem… I have scoured the PHP manuals and Google to no avail…
The only vague reference I could find that might work is to “echo” the entire line of HTML. If this is a good solution can someone be so kind as to share an example of how to modify my working “DIV” with embedded “echo” to code that is an “echo” with embedded “DIV”?
Now after I realised they’re two different functions, I would suggest replacing
with
this function should be returning a value, which you can then compare against
""further you could replace
with