Home Forums Event Espresso Premium Problem In Load More Event

Problem In Load More Event

Posted: May 9, 2018 at 1:02 am


May 9, 2018 at 1:02 am

Hi Support,

We have using custom query to get event and try to write load more functionality but in attribute “paged” parameter is not working it gives same result as loaded on first page.

$atts = array(
'title' => NULL,
'limit' => 5,
'paged' => $paged,
'css_class' => NULL,
'show_expired' => FALSE,
'month' => NULL,
'category_slug' => NULL,
'order_by' => 'start_date',
'sort' => 'ASC'
// run the query
global $wp_query;
$wp_query = new EE_Event_List_Query( $atts ); ?>

Please check above code and please provide help for create load more pagination code. (if possible please provide examples that would be more beneficial. )


  • Support Staff

May 9, 2018 at 9:12 am

Hi there,

I’m afraid there is no pagination code in what you posted above.

Here’s a link to a developer resource that show some examples of how to add pagination:


May 9, 2018 at 9:48 pm

Hi Josh,

Thanks for quick response.

Please check below reference link.
I have taken code from that (your example-query.php) to create custom page template but when I try to create ajax load more pagination that time I need to pass “paged” parameter and that was not working as per reference code.

( Just change $wp_query = new EE_Event_List_Query( $atts ); instead of your $wp_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery( $atts ); )
Reference :

Ajax Load More my referred link:

As per above ajax reference link we need to pass data to “paged” parameter to get next post so I have try to implement this in your your code but it don’t work.

can you please help me to implement load more ajax query?

// ===== ==== Page template code ===== ====
I used your example-query.php code.

// ============ Load more ajax function ======== ======
function more_post_ajax(){

$ppp = (isset($_POST["ppp"])) ? $_POST["ppp"] : 3;
$page = (isset($_POST['pageNumber'])) ? $_POST['pageNumber'] : 0;

header("Content-Type: text/html");

$atts = array(
'title' => NULL,
'limit' => $ppp,
'paged' => $page,
'css_class' => NULL,
'show_expired' => FALSE,
'month' => NULL,
'category_slug' => NULL,
'order_by' => 'start_date',
'sort' => 'DSC',
$loop = new EE_Event_List_Query( $atts );

$out = '';

if ($loop -> have_posts()) : while ($loop -> have_posts()) : $loop -> the_post();
$out .= '<div class="small-12 large-4 columns">


add_action('wp_ajax_nopriv_more_post_ajax', 'more_post_ajax');
add_action('wp_ajax_more_post_ajax', 'more_post_ajax');

// ===== ==== Ajax code in javascript file ===== ====
var ppp = 3; // Post per page
var cat = 8;
var pageNumber = 1;

function load_posts(){
var str = '&cat=' + cat + '&pageNumber=' + pageNumber + '&ppp=' + ppp + '&action=more_post_ajax';
type: "POST",
dataType: "html",
url: ajaxurl, // Define ajax url in file
data: str,
success: function(data){
var $data = $(data);
} else{
error : function(jqXHR, textStatus, errorThrown) {
$loader.html(jqXHR + " :: " + textStatus + " :: " + errorThrown);

return false;

$("#more_posts").on("click",function(){ // When btn is pressed.
$("#more_posts").attr("disabled",true); // Disable the button, temp.

If I used above all code with post or Custom post type then it will work fine but with Event Espresso I didn’t found why it is not working.

Please help me to implement Load more functionality into Event Espresso.



  • Support Staff

May 10, 2018 at 1:30 pm

Hi Pankaj,

Event Espresso events are custom post types, so whatever you’re doing different with the custom post type query you already have working, you can apply the same code to a query for Event Espresso events.

With regards to the sample code from the gist, I’ve updated it to include simple pagination. Sorry, no AJAX styled pagination included in the example, that’s really outside of the scope of support. I can recommend following this tutorial if you need to implement AJAX pagination:


May 11, 2018 at 2:42 am

Hi Josh,

I already tried with custom query but it is not working.
Eg. If I want to sort orderby title, event start date or by meta key then it is not possible.

So isn’t possible to add ” ‘paged’ => $page, ” or ‘offset’ => 3, in parameter?



  • Support Staff

May 11, 2018 at 5:41 am

It is possible to add 'paged' => $page, and 'offset' => 3, in the arguments. ('limit' also works) The updated example code uses 'paged' and 'limit'.

The support post ‘Problem In Load More Event’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Josh 8 months, 1 week ago ago

Topic Tags



This topic is: not resolved
Do NOT follow this link or you will be banned from the site!