WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Grouping by location?

[Resolved] Grouping by location?

Viewing 7 replies - 1 through 7 (of 7 total)
  • agelonwl
    Member

    @angelonwl

    Hi,

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

    pavelevap
    Participant

    @pavelevap

    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…

    pavelevap
    Participant

    @pavelevap

    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.

    agelonwl
    Member

    @angelonwl

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

    Event Search Attributes

    pavelevap
    Participant

    @pavelevap

    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…

    agelonwl
    Member

    @angelonwl

    how about removing event_start_date in the shortcode?

    pavelevap
    Participant

    @pavelevap

    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…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Grouping by location?’ is closed to new replies.