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

Viewing 2 reply threads


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

    • Support Staff

    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!!!

      Viewing 2 reply threads

      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.

      Event Espresso - Staging Server