I am using a plugin to manage events on a wordpress website. Events can be taggued, but they do not have any categories, which leads to an issue.
The listing pages lists those events, but since they dont have any categories it shows an error for the events.
The error :
NOTICE: UNDEFINED OFFSET: 0 IN /xxxxxxxx/ARCHIVE.PHP ON LINE 39
NOTICE: TRYING TO GET PROPERTY OF NON-OBJECT IN /xxxxxxxx/ARCHIVE.PHP ON LINE 39
The php code :
<span class="mvp-feat1-cat"><?php $category = get_the_category(); echo esc_html( $category[0]->cat_name ); ?></span>
Any idea how to fix this? I am guessing that I should check if get_the_category()
returns an object or an error or something?
Thanks !