I'm trying to just write a simple PHP if statement that checks if a custom field has anything entered into or if it has been left blank.
when it is blank it is meant to not print anything to the page, if something is set in the custom field then it should create a li element with an a tag inside of it.
here is my code so far:
<ul class="externalLinks">
<? $emptycheck = get('linkname',2,1,0);
if (isset($emptycheck)){ ?>
<li><a href="<? echo get('targethref',2,1,0); ?>"><? echo get('linkname',2,1,0);?></a></li>
<? } else { '' } ?>
<li><a href="<? echo get('PDFdownload'); ?>">Download a PDF of this project</a></li>
</ul>
The custom fields in this case are set by the wordpress admin (through the flutter plugin). The issue I am having is simply that if the custom fields are left blank an empty
<li><a></a></li>
is created.
get('linkname',2,1,0) returns the field content obviously (this part works).
Any ideas would be much appreciated.
Thanks, Jannis