Support

Home Forums Event Espresso Premium Add "No Events" text to Events Archive

Add "No Events" text to Events Archive

Posted: June 10, 2020 at 1:33 pm

Viewing 7 reply threads


lovelocaldesign

June 10, 2020 at 1:33 pm

Hello, I’ve been searching your support forum and looking at old posts, but I still haven’t figured out the answer to my question. I have a site that does not use the archives page to pull the Events information. Or at least, there is no code in the archives page which is specifically for the events archive. As such, I don’t know how to add “No events at this time”. to the page. As of right now the Events page is blank. I added a content-none.php but that did not work. I feel like I’m missing a snippet that should be added to the archives page.

Event Espresso – 4.10.6.p
WP 5.4.1


Tony

  • Support Staff

June 11, 2020 at 5:54 am

Hi there,

Event Espresso does not need ‘event specific’ code in your archives table to display, EE events are a custom post type within WordPress so your theme should output them as any other event and then we inject the event content into the output.

Which theme are you using?

If its a custom theme you’ve built can you can’t me a a copy so I can take a look?


lovelocaldesign

June 11, 2020 at 7:14 am

What is the best way to send you a copy of the theme? Zip format? Where do I send it?


Tony

  • Support Staff

June 11, 2020 at 7:28 am

Zip format yes. You’ll need to host it somewhere and post the link (you can set you reply to be private).

Or use a server like WeTransfer and send to support[at]eventespresso.com


lovelocaldesign

June 11, 2020 at 8:32 am

Ok, sent to that address via WeTransfer. Thank you.


Tony

  • Support Staff

June 11, 2020 at 9:17 am

Ok, if you follow the template hierarchy you’ll see that archives are output using mainly an archive.php template or if that one isn’t available index.php

Right now you’re specifically checking in index.php for:

if ( is_post_type_archive( 'espresso_events' ) ) {...}

That’s fine but you don’t really need to do it that way and it’ll start to get messy the more conditionals you add.

If you want to specifically style the EE event archive, copy your index.php file and call it archive-espresso_events.php

That template file will ONLY be used to display the archive for Event Espresso events so you don’t need those conditionals.

Then, on line 59 you have an else:

<?php else : ?>

Change that to:

<?php else : get_template_part( 'content', 'none' ); ?>

That will call your content-none.php template when the archive has no events to output.


lovelocaldesign

June 11, 2020 at 9:35 am

Yes!!! Success!! Thank you so much!


Tony

  • Support Staff

June 11, 2020 at 10:04 am

You’re most welcome.

Viewing 7 reply threads

The support post ‘Add "No Events" text to Events Archive’ 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