• Resolved akide

    (@akide)


    Hi, I would like to show the location past events (with use of #_LOCATIONPASTEVENTS string) in descending order and not increasing as it happens now.
    I know that I can change order in Location Pages settings but if I change it there, I change settings for location next events too.
    I would like to have Next Events with increasing order and past events with descending order.
    How can I have this function?

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter akide

    (@akide)

    Please can someone help me?

    Plugin Support angelo_nwl

    (@angelo_nwl)

    you can create custom locations placeholder eg. https://pastebin.com/jT7XcrxK

    Thread Starter akide

    (@akide)

    Thank you very much! I solved with this:

    add_filter('em_location_output_placeholder','my_em_placeholder_mod',1,3);
    function my_em_placeholder_mod($replace, $EM_Location, $result){
    	switch( $result ){
    	case '#_LOCATIONPASTEVENTS':
    		$events = EM_Events::get( array('location'=>$EM_Location->location_id, 'scope'=>'past', 'limit'=>10, 'order'=>'DESC', 'orderby'=>'event_start_date') );
    		if ( count($events) > 0 ){
    			$replace = get_option('dbem_location_event_list_item_header_format');
    			foreach($events as $event){
    				$replace .= $event->output(get_option('dbem_location_event_list_item_format'));
    			}
    			$replace .= get_option('dbem_location_event_list_item_footer_format');
    		} else {
    			$replace = get_option('dbem_location_no_events_message');
    		}
    		break;
    	} 
    	return $replace;
    }
    Thread Starter akide

    (@akide)

    I have one problem with this function.
    When I look at event page I’cant no more have pagination (1,2,3,4, etc.) at the bottom of the list. I have removed ‘limit’=>10, in the code but now I see a list too much long with all past events.
    ( https://nuovosito.angelipierre.it/eventi/pista-commerciale-e-pista-latina-coconuts-rimini/ )
    Maybe you can help me to add pagination?
    Thank you.

    Thread Starter akide

    (@akide)

    @angelo_nwl Please, can You help me?

    Thread Starter akide

    (@akide)

    @angelo_nwl please can you say me if pagination is possible in this type of situation?

    Plugin Support angelo_nwl

    (@angelo_nwl)

    another way is something like this

    
    add_filter('em_location_output_placeholder','my_em_placeholder_mod',1,3);
    function my_em_placeholder_mod($replace, $EM_Location, $result){
    	switch( $result ){
    	case '#_LOCATIONPASTEVENTS':
    		$replace = do_shortcode('[events_list location="'.$EM_Location->location_id.'" pagination=1 scope="past" limit=10 order="DESC" orderby="event_start_date" ]');
    		break;
    	} 
    	return $replace;
    }
    
    Thread Starter akide

    (@akide)

    @angelo_nwl Thank you very much! It Works fine!

    Thread Starter akide

    (@akide)

    @angelo_nwl Please, can you help me again? With last Events Manager Upgrade (5.9.5) , this code does not work anymore, why?

    Solved: Sorry, it was my mistake!

    • This reply was modified 6 years, 1 month ago by akide.
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Change Location Past Events Order’ is closed to new replies.