Support

Home Forums Event Espresso Premium Default Message For No Events?

Default Message For No Events?

Posted: January 5, 2020 at 1:11 pm

Viewing 3 reply threads


rmazook4

January 5, 2020 at 1:11 pm

Hello, I would like to be able to supply a message should there be new events listed, currently the page just loads nothing. Is there a setting somewhere or a way for me to add a message to my custom templates with PHP?


Tony

  • Support Staff

January 6, 2020 at 7:20 am

Hi there,

Which custom templates are you referring to?

Which page loads nothing?

If it’s the default events archive it’s using your theme’s archive.php template (if it has one, index.php if not) so that template needs to load some content (or another template part) if there are no posts but really we need more specific on the output you are viewing as there are a few.


rmazook4

January 9, 2020 at 7:07 pm

Category list would be the one I’m hoping to fix. So if someone chooses an event by category to view, how can I add a message that says “no events” if there are none in that particular category? As of now it just loads header and footer and no content.


Tony

  • Support Staff

January 10, 2020 at 6:18 am

Ok, so you mentioned custom templates in your opening post so I’m assuming you have your own custom theme?

So if you follow the WP template hierarchy:

https://developer.wordpress.org/files/2014/10/Screenshot-2019-01-23-00.20.04.png

Assuming you don’t have custom templates set up for the EE taxonomies you’ll be using either taxonomy.php, archive.php or index.php in that order.

With the loop, you’ll usually have an if( have_posts() ) so after that you’ll do an else and load a template displayed when you don’t have posts.

For an example of this from within EE example templates see here:

https://github.com/eventespresso/event-espresso-core/blob/master/public/Espresso_Arabica_2014/loop-espresso_events.php#L54-L57

That’s calling a content-none.php template file with whatever is in that to display for no posts, your theme isn’t doing that and you’ll need to add it to one/all of the above templates to all a template part for when you have no posts.

Viewing 3 reply threads

The support post ‘Default Message For No Events?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso