I'm essentially converting this php code into a string assigned to a var so I can return it's value within a function:
<?php if ($add_cta=='yes' ){?>
<a class="button" href="<?php echo strip_tags(trim($a_href)); ?>">
<?php echo strip_tags(trim($a_title)); ?>
</a>
<?php } ?>
I have converted the above into the following:
$html = '
($add_cta == "Yes" ? .
' < a class = "button" href = "'.strip_tags(trim($a_href)).
'" > '.strip_tags(trim($a_title)).
' < /a>'. : "")
';
return $html;
But getting unexpected '.' errors on the line ($add_cta == "Yes" ? .'
But that is required to concat the string and php, right? where am I going wrong