WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Grouping by location? (8 posts)

  1. pavelevap
    Member
    Posted 1 year ago #

    Hello,

    is it possible to use events_list shortcode and grouping events by location and then start date?

    Thank you for your help!

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

  2. agelonwl
    Member
    Posted 1 year ago #

    Hi,

    this might help you out - http://pastebin.com/9VWCquiT

  3. pavelevap
    Member
    Posted 1 year ago #

    I wanted to modify main events-list shortcode, but I am stuck now :-(

    I tried this code:

    add_filter( 'em_events_get_default_search', 'my_em_styles_get_default_search', 1, 2);
    function my_em_styles_get_default_search( $searches, $array ) {
    	if( !empty( $array['template']) ) {
    		$searches['template'] = $array['template'];
    	}
    	return $searches;
    }
    
    add_filter( 'em_events_output_args' , 'my_em_events_output_args' );
    function my_em_events_output_args( $args ) {
    if ( isset( $args['template'] ) && !empty( $args['template'] ) ) {
    	$args['format_header'] = '<ul>';
    	$args['format_footer'] = '</ul>';
    	$args['format'] = '<li>#_EVENTLINK - #_LOCATIONLINK, #_EVENTDATES</li>';
    	$args['orderby'] = 'location_id,event_start_date';
    }
    return $args;
    }

    But it does not order well...

    All I want is modified list of events when adding shortcode [events_list template="test"]:

    Event 1 - Location 1
    Event 3 - Location 1
    Event 2 - Location 2

    Any idea? Thank you for your help...

  4. pavelevap
    Member
    Posted 1 year ago #

    agelonwl: Thank you for your code, but if I understood it correctly, shortcode location_group shows only list of states and regions (grouped). I want to make list of events which could be sorted (grouped) first by location and then start date.

  5. agelonwl
    Member
    Posted 1 year ago #

    try shortcode [events_list order="ASC" orderby="location_name,event_start_date"]

    http://wp-events-plugin.com/documentation/event-search-attributes/

  6. pavelevap
    Member
    Posted 1 year ago #

    Thank you for your answer! Yes, I tried this and it does not work, maybe bug?

    Results are the same as simple event_lists shortcode without arguments:

    Event 1 - Location 1 - 06/06/2011 - 18/12/2013
    Event 2 - Location 2 - 21/12/2012
    Event 3 - Location 3 - 28/05/2018
    Event 4 - Location 1 - 28/12/2012

    I would like to sort events like this (grouped locations):

    Event 1 - Location 1 - 06/06/2011 - 18/12/2013
    Event 4 - Location 1 - 28/12/2012
    Event 2 - Location 2 - 21/12/2012
    Event 3 - Location 3 - 28/05/2018

    I tried to debug queries, but with no success. But it looks like some kind of bug...

  7. agelonwl
    Member
    Posted 1 year ago #

    how about removing event_start_date in the shortcode?

  8. pavelevap
    Member
    Posted 1 year ago #

    No way :-( I tried everything... I tried location, location_id and location_name. It looks like location is ignored somehow... Could you please test it if I am not crazy? You need only some testing events...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic