vendredi 4 juin 2021

If Not Empty PHP WordPress Syntax Causing Critical Error

Can someone please help me fix this PHP code?

<?php
$ori = the_terms('origin');
if (!empty($ori)):
    ?>
    <div class="tax"><p class="origin tax-label">Origin</p><p class="tax-link tax-label"><?php the_terms( $post->ID, 'origin', '' ); ?></p></div>
<?php
   endif;
?>

It saves without any errors in the PHP file through the WordPress dashboard but shows "There has been a critical error on this website." on the front end.

I'm trying to display a custom taxonomy "origin" on the front-end, but only if it's not empty.

Please help. Thanks in advance 🙂

Aucun commentaire:

Enregistrer un commentaire