Support

Home Forums Event Espresso Premium Code to display events archive – limited at 10

Code to display events archive – limited at 10

Posted: April 4, 2017 at 8:35 am

Viewing 1 reply thread


David

April 4, 2017 at 8:35 am

Hello

I’m using this custom code in a shortcode I created to display a list of archived events.

$start_date = $year.'-01-01 00:00:00';
	$end_date = $year.'-12-31 23:59:59';

	$start_date = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $start_date, 'Y-m-d H:i:s', 'Europe/London' );
$end_date = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $end_date, 'Y-m-d H:i:s', 'Europe/London' );
$events = EEM_Event::instance()->get_all(
    array(
        array(
            'Datetime.DTT_EVT_start' =>
                array(
                    'BETWEEN',
                    array( $start_date, $end_date )
                ),
        ),
    )
);

	
	
	foreach($events as $event){
	// loop here
		
		$ids[] = $event->get('EVT_ID');
}

$year is obviously the year I’m trying to show all the events from.

It then gets the $ids and code further down fetches each ID and displays info from it.

It seems to however be limited to 10 events. Right now I have 12 events listed for 2016, and yet it’s sticking at 10. If I remove some, it then displays the ones that weren’t showing before.

Any ideas?

Thanks,
David


Josh

  • Support Staff

April 4, 2017 at 9:15 am

Hi David,

Unless you specify otherwise by filtering the query’s limit, any modified WP Query will return the number of posts set on the WP > Settings > Reading Settings page, for the “Blog pages show at most” option. If you go to that page in the admin is the option set to 10?

Viewing 1 reply thread

The support post ‘Code to display events archive – limited at 10’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso