I am trying to implement the below code, but as a result get displayed nothing back.
<li class="cleanup">Garantie:<span><?php (get_post_meta(get_the_ID(), 'Garantie', true); ?> Jahre</span><?php echo (get_post_meta(get_the_ID(), 'Garantie', true) >= 2) ? ('<span class="pro_con pro"><i class="fa fa-check"></i>Lange Garantie: ' . <?php (get_post_meta(get_the_ID(), 'Garantie', true)); ?> . ' Jahre</span>') : ('<span class="pro_con pro"><i class="fa fa-check"></i>Standart Garantie: ' . <?php (get_post_meta(get_the_ID(), 'Garantie', true)); ?> . ' Jahre</span>'; ?>) </li>
The field should be available and the function get_post_meta
does work!
I assume that I have a syntax error, but I am not sure where?
Any suggestions what I am doing wrong?
I appreciate your replies!
You have an extra parenthesis, change to
And by the way, you must have your logging on on devel env, logs help a lot.
You have some extra closing
?>
php tags inside the Ternary operator.Modified Code:
Try this :
How about something like this:
Afterall, readability counts…