Support

Home Forums Event Espresso Premium Remove Widget if NO events listed?

Remove Widget if NO events listed?

Posted: August 15, 2013 at 1:53 pm


Carlos Flores

August 15, 2013 at 1:53 pm

I have the latest everything. WordPress and Event Espresso.

I am hoping this is solvable…

I am using Upcoming Event widget but the widget still appears even if there is no events listed. How I do have the widget not show up if there is no events.

Thanks in advance!


Sidney Harrell

August 15, 2013 at 8:19 pm

If you make a copy of plugins/event-espresso/templates/widget.php and place it in uploads/espresso/templates, then you can modify it and keep the modifications after you update. Remove the following lines starting at line 28:

/* Before widget (defined by themes). */
            echo $before_widget;

            /* Display the widget title if one was input (before and after defined by themes). */
            if ($title)
                echo $before_title . $title . $after_title;

then place the following at what will then be line 64, after

$events = $wpdb->get_results($sql);
if (count($events) == 0)
							return;
						
						/* Before widget (defined by themes). */
            echo $before_widget;

            /* Display the widget title if one was input (before and after defined by themes). */
            if ($title)
                echo $before_title . $title . $after_title;


Carlos Flores

August 16, 2013 at 10:06 am

Awesomenessssss!!!!

Thank you very much Sidney!

Worked like a charm!

EE Rocks and the people that make it work rock even more!!!

The support post ‘Remove Widget if NO events listed?’ 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  Carlos Flores 6 years, 3 months ago ago

Topic Tags

Notifications

This topic is: resolved
Do NOT follow this link or you will be banned from the site!
[for="input_96_5_3"]
[for="input_96_5_3"]
[gravityform id=96 title=false description=false]
  • This field is for validation purposes and should be left unchanged.
[i]
[i]
[gravityform id=69 title=false description=false]
  • This field is for validation purposes and should be left unchanged.