Support » Plugins and Hacks » Broken em_events_output_pagination filter?

Broken em_events_output_pagination filter?

  • I have just noticed that the event list/archive pagination is not working any more on my site. It was working for the past few months (I had posted this here: http://wordpress.org/support/topic/pagination-styling?replies=5) and I have not touched anything since then.

    There were some updates to this plugin which I installed, so I don’t know at which point this broke.

    Were there any changes done to the em_events_output_pagination filter lately? It is being invoked but something seems to have changed to the arguments because it seems I am not getting anything in the $link template (the second parameter), or something unexpected is being passed to it.

    My event hook function looks like this:

    function my_em_paginate($links, $link, $total, $limit, $page=1, $pagesToShow=10)
       //my code
       return apply_filters('em_paginate', $string);
    add_filter('em_events_output_pagination','my_em_paginate', 1, 6);


Viewing 15 replies - 1 through 15 (of 21 total)
  • angelo_nwl


    NetWebLogic Support


    using pastebin.com can you share your whole snippet?

    Sure, here it is:


    The Previous and Next are appearing as they should, however their HREF links are ending up completely empty.



    NetWebLogic Support

    I tried your snippet and seems to work? can I know what’s happening on your site?

    I also have my own event-list.php under my own theme in plugins/events-manager/templates

    Maybe something changed in the functions used by that then?

    Code here: http://pastebin.com/kseiFXDg



    NetWebLogic Support

    I see, maybe your custom event-list.php template needs updating also. but can I also know what’s happening on your site since it’s abit unclear.


    You mean you want to see the site URL?
    This is the link: http://www.eve.com.mt/events

    As you can see if you do ‘View Source’ the NEXT link just has an empty HREF.


    First thing to do here really is to temporarily remove your customisations and see if pagination works. If it does, we know to focus on your modifications.

    Could you try that please and let us know what the outcome is?


    Hi philipjohn,

    So, I temporarily removed the custom event-list.php, so that it uses the default ugly list of events. The next link still didn’t have any HREF.

    I then temporarily commented out the filter I pasted earler here: http://pastebin.com/AUxjPkiB

    The ugly 1 2 3 > links appeared and their page links were fine. So I guess one of the latest updates had some change which broke this in some way? Even though angelo_nwl said he tried my snippet and it worked for him.



    NetWebLogic Support

    here’s another thing you can try; using default pagination you can hook into em_paginate then use css/php to modify the pagination

    if you use the em_paginate filter, you could just wrap the contents in a div, eg.

    function my_em_paginage($content){
      return "<div>$content</div>";

    Hi angelo_nwl,

    I don’t want the default pagination. The client just wants NEXT and PREV with some surrounding wrapper elements for styling them one to the left and one to the right and putting the respective images around them. Its not as simple.

    OK, so I put some echo lines in my pagination hook function and I found that since one of the recent versions, the second parameter which should be the $link template is completely empty. This used to have the link with the PAGE parameter.

    Did the order of parameters change or something?


    I compared events-manager/classes/em-events.php of the latest version with the newest version, and I think the bug is in this line, in functions output() and output_grouped().

    $output .= apply_filters('em_events_output_pagination', self::get_pagination_links($args, $events_count, 'search_events_grouped', self::get_default_search()), '', $events_count, $args['limit'], $args['page']);

    The $link_template parameter passed to the filter is explicitly being set to '', no wonder I am getting an empty string.

    In the old version when it worked it used to be:

    $page_link_template = preg_replace('/(&|\?)pno=\d+/i','',$_SERVER['REQUEST_URI']);
    $page_link_template = em_add_get_params($page_link_template, array('pno'=>'%PAGE%'), false); //don't html encode, so em_paginate does its thing;
    $output .= apply_filters('em_events_output_pagination', em_paginate( $page_link_template, $events_count, $limit, $page), $page_link_template, $events_count, $limit, $page);

    The $page_link_template was explicitly being set. Now it disappeared.

    Can you schedule a fix to bring this back to work properly?

    I fixed it by changing the output line to the following in events-manager/classes/em-events.php:

    $page_link_template = preg_replace('/(&|\?)pno=\d+/i','',$_SERVER['REQUEST_URI']);
    $page_link_template = em_add_get_params($page_link_template, array('pno'=>'%PAGE%'), false); //don't html encode, so em_paginate does its thing;
    $output .= apply_filters('em_events_output_pagination', self::get_pagination_links($args, $events_count, 'search_events', self::get_default_search()), $page_link_template, $events_count, $limit, $page);

    However, it will be lost the moment I update to a newer Events Manager version. Can it be included in the next version before a new update is issued?



    I do get the issue when trying your snippet so I will pass this along to Marcus for a fix.


    Cheers! I think there are a couple of more places where the filter is being invoked, so might be a good idea to check them out.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Broken em_events_output_pagination filter?’ is closed to new replies.