This question already has an answer here:
This only appears when I have WordPress in debug mode, but I'm still concerned about it. Basically, I'm using the plugin The Events Calendar with a bunch of custom fields. Want them to display in the template but only if the field has a value selected.
So I wrote this in my template:
<?php if( $additional_fields[ 'Crowds' ]) { echo '<i class="fas fa-users"></i> ' . $additional_fields[ 'Crowds' ] . ' Crowds' ; } ?>
And it came back with the following:
Notice: Undefined index: Crowds in /home/hellod8/public_html/wp-content/themes/dadventure/tecshortcode/custom.php on line 30
So I'm trying to figure out how to correct this or it's just a FOL. I also did try to include
if( $additional_fields[ 'Crowds' ] == "0"
or
if( $additional_fields[ 'Crowds' ] == ""
but no luck on any of them.
Aucun commentaire:
Enregistrer un commentaire