Support

Home Forums Event Espresso Premium Events per page

Events per page

Posted: July 10, 2014 at 6:44 am

Viewing 7 reply threads


blue level

July 10, 2014 at 6:44 am

hi
i have used the shortcode
[EVENT_ESPRESSO_CATEGORY event_category_id=”APLH-1403689916″]

but each page has a diffrent number of events on it

haow can i display the same amout per page


Lorenzo Orlando Caum

  • Support Staff

July 10, 2014 at 7:01 am

Hi,

You can use the pagination option here:

https://eventespresso.com/wiki/shortcodes-template-variables/#event-list

[EVENT_LIST category_identifier=your_category_identifier events_per_page=10]


Lorenzo


blue level

July 14, 2014 at 8:01 am

Hi, there seems to be a problem with the paging mechanism in that the paging applies to the SQL resultset (500+ events are returned in the result set) ..but further down in where the events are rendered there is additional logic causing inactive events to be hidden, breaking the paging logic?

Thanks.


blue level

July 14, 2014 at 9:00 am

Just to clarify: the code I was looking at was in the file /plugins/event-espresso/templates/event_list.php …around line 406. Is this an issue that you guys will be looking at fixing? Is this something that is resolved in version 4?


Tony

  • Support Staff

July 14, 2014 at 9:19 am

Hi Blue,

We have a fix for this due for release with the next version of Event Espresso. However If you would like to apply this fix to your current version of EE you can edit the file event-espresso/templates/event_list.php

Theres 2 edits to make, firstly on line 65 you’ll find:

'use_wrapper' => true

Add a comma to the end of that line and then under that add:

'exclude_closed_events'	=> 'false'

So like this – http://take.ms/rP6i2

Then on (now) line 149 you’ll find:

$sql .= $show_expired == 'false' ? " AND (e.start_date >= '" . date('Y-m-d') . "' OR e.event_status = 'O' OR e.registration_end >= '" . date('Y-m-d') . "') " : '';

Change that to be

if($exclude_closed_events == 'false'){
			$sql .= $show_expired == 'false' ? " AND (e.start_date >= '" . date('Y-m-d') . "' OR e.event_status = 'O' OR e.registration_end >= '" . date('Y-m-d') . "') " : '';
		} else {
			$sql .= $show_expired == 'false' ? " AND (e.event_status = 'O' OR e.registration_end >= '" . date('Y-m-d') . "') " : '';
		}

Like so – http://take.ms/cTf3c

You now have a new attribute ‘exclude_closed_events’, set that to true within your shortcode to remove close/expired events from results.

exclude_closed_events=true

[EVENT_LIST category_identifier=your_category_identifier events_per_page=10 exclude_closed_events=true]


Tony

  • Support Staff

July 14, 2014 at 9:21 am

Also to note EE4 is a vastly different system in that it uses custom post types for the events meaning the pagination is the done in the same way as standard posts.


blue level

July 14, 2014 at 4:50 pm

This doesn’t seem to fix our problem.
I think the problem is the logic that is filtering out expired events. I think the logic should possibly be:

$sql .= $show_expired == 'false' ? " AND ((e.start_date >= '" . date('Y-m-d') . "' AND e.registration_end >= '" . date('Y-m-d') . "') OR OR e.event_status = 'O') " : '';

…non-expired event = registration end date AND the event start date or both in the future (or the event is ongoing).

I’m yet to try this out so I may be way off the mark.


Josh

  • Support Staff

July 14, 2014 at 5:09 pm

Hi Blue,

It kind of depends on how you want to define expired, so you’re welcome to tweak the template to fit your needs.

Viewing 7 reply threads

The support post ‘Events per page’ 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