Home Forums Event Espresso Premium Upcoming Events Widget

Upcoming Events Widget

Posted: September 4, 2018 at 1:45 pm


September 4, 2018 at 1:45 pm

Is there a way to auto hide the Upcoming Event Widget if there are no other events scheduled? Especially interested in auto hiding from the Single Event listing, since many times, it is the only one event scheduled and when you view details, the Upcoming Events Widget is blank.

If cannot auto hide, can the widget state, “There are currently no events scheduled.”?

Using Upcoming Event widget with Version 4.9.67.p.


  • Support Staff

September 4, 2018 at 8:39 pm


You can add the following code to hide the widget if there are no events:

function my_hide_widget_if_no_events() {
    $script = 
    '<script>jQuery( document ).ready( function( $ ){
        if( !$("").has("li").length ) {
    echo $script;
add_action( 'wp_footer', 'my_hide_widget_if_no_events', 20 );

You can add the above to a functions plugin or into your WordPress child theme’s functions.php file.


September 5, 2018 at 9:27 am

Thank you… worked perfectly!!

The support post ‘Upcoming Events Widget’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  asse2014 1 year, 4 months ago ago

Topic Tags


This topic is:
Do NOT follow this link or you will be banned from the site!