• I notice that the The Events Plugin widget can be set to NOT display in the sidebar if no upcoming events are available. That’s great but the plugin still places an empty list item (li) into the sidebar.

    This can be a pain since styling the list items (such as horizontal rules or whatever) will cause an empty sidebar area to show up with no content. Hence, there might be two horizontal rules (one for the empty Upcoming Events list item and then a second rule immediately below for the next sidebar list item that has content).

    Seems like a much better approach to have no list item appear at all if there are no upcoming events.

Viewing 4 replies - 1 through 4 (of 4 total)
  • on events-list-widget.class.php
    Look for
    /* Before widget (defined by themes). */
    from that statement all the way to:
    /* After widget (defined by themes). */

    replace everything in-between with:

    /* Before widget (defined by themes). */
    
    				if( function_exists( 'get_events' ) ) {
    					$old_display = $wp_query->get('eventDisplay');
    					$wp_query->set('eventDisplay', 'upcoming');
    					$posts = get_events($limit, The_Events_Calendar::CATEGORYNAME);
    				}
    
    				/* Title of widget (before and after defined by themes). */
    				if ( $title && !$noUpcomingEvents )
    				echo $before_widget;
    				echo $before_title . $title . $after_title;
    
    				if( $posts ) {
    					/* Display list of events. */
    						if( function_exists( 'get_events' ) ) {
    
    							echo "<ul class='upcoming'>";
    							foreach( $posts as $post ) :
    								setup_postdata($post);
    								if (file_exists(TEMPLATEPATH.'/events/events-list-load-widget-display.php') ) {
    									include (TEMPLATEPATH.'/events/events-list-load-widget-display.php');
    								} else {
    									include( dirname( __FILE__ ) . '/views/events-list-load-widget-display.php' );
    								}
    							endforeach;
    							echo "</ul>";
    
    							$wp_query->set('eventDisplay', $old_display);
    						}
    
    						/* Display link to all events */
    						echo '<div class="dig-in"><a href="' . $event_url . '">' . __('View All Events', $this->pluginDomain ) . '</a></div>';
    			echo $after_widget;	}
    			else if( !$noUpcomingEvents ) _e('There are no upcoming events at this time.', $this->pluginDomain);
    
    				/* After widget (defined by themes). */

    All I did was put the echo $before_widget; and echo $after_widget;
    inside the if ( $title && !$noUpcomingEvents ) loop

    @tokidoki2005

    Thanks for the fix. This will be included in the next release.

    Justin

    Thread Starter sassymonkey

    (@sassymonkey)

    Excellent! And thanks for both the fix and integrating it so quickly. It’s working perfectly now. Thanks again.

    Yes, thanks for this fix!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: The Events Calendar] Empty Widget li With No Upcoming Event’ is closed to new replies.