WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
Adding Taxonomy Sorting in v5 (11 posts)

  1. maxlollar
    Member
    Posted 2 years ago #

    Hi - I'm using Events Manager v5, and I have added a taxonomy for "Languages" for events. In each event, I can set a language, but how do I make the event search/filter form also query for this taxonomy (in addition to the date range, categories, etc.)?

    Thanks!

    http://wordpress.org/extend/plugins/events-manager/

  2. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

  3. Miguel Peixe
    Member
    Posted 2 years ago #

    I have multiple custom taxonomies to handle my events. I've been trying to make it work, as explained in step 6:

    at my functions.php:

    add_filter('em_events_get', 'my_em_taxonomies_events_get', 1, 2);
    
    function my_em_taxonomies_events_get($events, $args) {
    	if(!empty($args['speaker'])) {
    		foreach($events as $event_key => $EM_Event) {
    			// check if the post is inside the specific term and unset the others
    		}
    	}
    	return $events;
    }

    at my query:
    echo EM_Events::output(array('speaker'=>'john-doe'));

    as I ran some debug i realized that my "speaker" attribute is not passing through the args... do you know any reason for that?

    thanks in advance

  4. Miguel Peixe
    Member
    Posted 2 years ago #

    oops, already fixed it

    i forgot to set the default_search filter, as mentioned first... sorry

  5. Miguel Peixe
    Member
    Posted 2 years ago #

    well... i stumpled upon another problem:

    as i unset the unwanted events (not under my specified speaker), how do I increase the loop to reach my specified limit?

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    you should probably modify the search SQL conditions instead of the above. Since attributes are now post meta, you can just search within the post meta as a subquery for example.

    The function is EM_Events::get_sql_conditions(), the hook is in there.

  7. Miguel Peixe
    Member
    Posted 2 years ago #

    thanks Marcus
    for that I should turn my term assignment into a post meta (using post meta hooks)?

  8. Miguel Peixe
    Member
    Posted 2 years ago #

    That seems strange... I wouldn't like to create a custom meta for every term assignment. That doesn't look very right to the WP semantics.

    To make the SQL condition properly (using the term assigment) I need to be able to add a JOIN in the sql query, so I can consult my custom taxonomies. Is there any hook for that?

    The query attrs are pretty good, but they completely exclude all the WordPress common query attrs. It seems kind of late to propose that, but I think you guys should check out how the WP E-Commerce plugin works around with their query system:

    <?php query_posts('post_type=wpsc-product'); ?>
    <?php while (wpsc_have_products()) :  wpsc_the_product(); ?>

    More info: http://docs.getshopped.org/category/developer-documentation/

    Hope you consider!

  9. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    since events are custom posts now you can completely circumvent our search functions if you want. eventually I might even add some sort of way to choose how EM searches for events too (our way or WP_Query way).

    you're right about the join issue, something I'd consider looking at when time permits...

  10. Miguel Peixe
    Member
    Posted 2 years ago #

    Hi Marcus,

    I realized I'm able to use the scope attribute (the most important to me) inside WP_Query. But they only accept 'past', 'future', 'all', 'next-month', etc... They don't accept '2012-02-01,2012-02-28'. Do you know why is that?

    About the custom taxonomy querying, I think that even creating a hook for the join issue is not a great solution. It will probably work, but would still be very hard for regular users to integrate custom taxonomy to their events.

    Maybe a custom hook that register the taxonomy, by the name, for the Events Manager plugin, fully integrated?

    Thanks

  11. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    Currently, this is only implemented for the admin area (e.g. where you choose future/past/etc. scopes.

    I'll be fixing that soon, eventually you'll be able to use WP_Query to make the same queries/values made with our search attributes.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic