Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget calendar can link to 'No events found' #30

Closed
stephenh1988 opened this issue Jan 10, 2013 · 1 comment
Closed

Widget calendar can link to 'No events found' #30

stephenh1988 opened this issue Jan 10, 2013 · 1 comment

Comments

@stephenh1988
Copy link
Collaborator

If a widget calendar is selected to show past events, but the archives do not, then a link is generated on past events which points to a 'No events found' message.

Possible workarounds:

  • Add 'event' class, but not a link (document this, and suggestions on styling). This may seem equally buggy.
  • Add a message warning of this.
@stephenharris
Copy link
Owner

Possible workaround is hide past events on the 'events' page, but show them on the day/month/year archive pages.

/** 
 * Hooked ont to pre_get_posts
 * If a specific archive is viewed (either day, month or year archive)
 * then over-ride the showpastevents option.
 * @param WP_Query $query
 */
function myprefix_show_past_events_ondate( $query ){

    if( $query->is_main_query() && eventorganiser_is_event_query( $query ) ){

        if( eo_is_event_archive( 'day' ) || eo_is_event_archive( 'month' ) || eo_is_event_archive( 'year' ) ){
                $query->set( 'showpastevents', true );  
        }

    }   

}
add_action( 'pre_get_posts', 'myprefix_show_past_events_ondate', 5 );

Although this then shows past events even when the user has chosen not to, this is probably closes to what most people actually want...

@stephenharris stephenharris removed this from the Future Release milestone Aug 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants