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

Improved query handling #58

Closed
stephenharris opened this issue Mar 11, 2013 · 2 comments
Closed

Improved query handling #58

stephenharris opened this issue Mar 11, 2013 · 2 comments
Milestone

Comments

@stephenharris
Copy link
Owner

This involves improving two distinct, but vaguely related, issues:

  1. Handling queries which are for (but not exclusively) events.
  2. Support all taxonomies 'out of the box' (i.e. support any taxonomy registered to the event post type.

Note for 1: Sorting should not be overridden unless the query is exclusively event type.

A work-around for 2. is:

add_action( 'pre_get_posts', 'my_event_taxonomy_query', 8 );
function my_event_taxonomy_query( $query ){

     if( $query->is_tax( 'my-event-taxonomy' ){
          $query->set( 'post_type', 'event' );
     }
}
@essamweb
Copy link

This is perfect!

add_action( 'pre_get_posts', 'my_event_taxonomy_query', 8 );
function my_event_taxonomy_query( $query ){
     if($query->is_tax('my-event-taxonomy')){
          $query->set( 'post_type', 'event' );
     }
}

@stephenharris
Copy link
Owner Author

Won't be needed in 1.8 :).

Currently the post type has to be event - a query with post type set to array( 'event' ) or array( 'post', 'event' ) or any - would be ignored by the plug-in (so no dates are pulled). It's going to be a lot more flexible in 1.8.

I have working code on my local repo, will push it here tomorrow.

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