• Resolved senorpedo

    (@senorpedo)


    If i want to order the list of events by start date, how do I do that? In your documentation it shows that “orderby” can be set to order by title, ID, name, modified, parent, rand. I want events to be ordered by when they actually happen, not by when they were posted or modified.

    Thanks

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @senorpedo,

    You can add meta query as per your requirements. Order by meta key some time not works in wordpress. You need to test several things to work some time it will works.

    function get_default_events_by_user_location($query_args,$args)
    {
          
        if ( empty( $args['search_location'] ) ) 
        {
                  
                    $ip = $_SERVER['REMOTE_ADDR'];
                    //$details = unserialize(file_get_contents("https://www.geoplugin.net/php.gp?ip={$ip}"));
                    $ch = curl_init();
                	curl_setopt($ch, CURLOPT_URL, "https://www.geoplugin.net/json.gp?ip=" . $ip);	            	
                	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);	            	
                	$response= curl_exec($ch);
                	$details=json_decode($response, true);
    	            curl_close($ch);
    	            
                    $country = $details["geoplugin_countryName"];
                    $city = $details["geoplugin_city"];
                    
                 
                   $location_meta_keys = array( 'geolocation_formatted_address', '_event_location', 'geolocation_state_long','geolocation_country_long' );
    
    	           $location_search    = array( 'relation' => 'OR' );
            			foreach ( $location_meta_keys as $meta_key ) {
                			$location_search[] = array(            
                				'key'     => $meta_key,
    
                				'value'   =>  $country ,
                
                				'compare' => 'like'
                			);
                		}
                		$query_args['meta_query'][] = $location_search;
                		return $query_args;
        }
        else
        {
                return $query_args;
        }
    
    }
    
    //filter for default location wise events
    add_filter('get_event_listings_query_args','get_default_events_by_user_location',10,2);

    In above example we have assign event which is inside perticular location.

    You can also try [events show_pagination="true" orderby="_event_start_date"]

    Let me know if it works.

    Thank you

    Thread Starter senorpedo

    (@senorpedo)

    I tried this:
    [events show_pagination=”true” orderby=”_event_start_date”]

    It did not make a difference. Any other ideas? I would really like to order events by the day that they begin. It seems to me that this should be the default way to display events!

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Really?

    @senorpedo Do not send the author admin access. That’s going way too far and the author risks getting into real trouble here for that.

    @hiteshmakvana I’ve deleted your offer to login to your user’s site. I’m am 100% sure you mean well but please never ask for credentials on these forums.

    https://www.ads-software.com/support/guidelines/#the-bad-stuff

    Now for the why: The internet is a wonderful place full of very nice people and a few very bad ones. I’m sure everyone here is very nice however, by giving some ones keys to your house you are trusting they wont steal anything. Likewise the person who takes the keys is now responsible for the house FOREVER.

    If something was to go wrong, then you the author may well legally become liable for damages, which they would not normally have been as their software is provided without warranty.

    Please be aware that repeatedly asking for credentials will result in us asking you to repeatedly stop before escalating up to the plugins team.

    Hi @senorpedo and @jdembowski,

    Sorry for the inconvenience. I have created documentation specially for you. It will help other user too in future.
    Please take a look at this documentation and let me know if you still has any issue.

    https://www.wp-eventmanager.com/documentation/ordering-events-by-event-start-date-meta-key/

    Yes, Thank you, that new document created worked perfectly for me.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Ording events on events page’ is closed to new replies.