My function should be my_em_paginate (see above). Hope anyone can help me.
maybe you can try something like this
paste in your theme functions.php
function em_change_pagination($string){
if ( strpos($string,'<') ){
$string = str_replace("<","< Previous page",$string);
}
if ( strpos($string,'>') ){
$string = str_replace(">","Next page >",$string);
}
$string = "<div class='em_pagination_link'>".$string."</div>";
return $string;
}
add_filter('em_paginate','em_change_pagination',10,1);
paste in your theme style.css
.em_pagination_link {
float:right;
}
You might want to look at this post, there are a couple of pastebin links of how I am doing it to style my pagination links.
http://wordpress.org/support/topic/broken-em_events_output_pagination-filter?replies=13
Beware there was a bug introduced, (check my latest post on the same thread), and the link template is being set to empty string. Hopefully a fix will be issued soon.
Thanks for your link, i tried yours already but i did not work for me.
This is what i got so for and used the guidelines from angelo.
function em_change_pagination($string){
if ( strpos($string,'<a') ){
$string = str_replace("<a","<li><a",$string);
}
if ( str_replace($string, "<li><a", "<strong><span")){
$string = str_replace("<strong><span","<li <a",$string);
}
$string = '<div class="pagination"><ul>'.$string.'</ul></div>';
return $string;
}
add_filter('em_paginate','em_change_pagination',10,1);
If i inspect the elements i see
<div class="pagination">
<ul>
<span class="em-pagination">
<li><a class="page-numbers current">1</a></li>
<li><a class="page-numbers" href="" title="2">2</a></li>
<li><a class="page-numbers" href="" title="3">3</a> </li>
<li><a class="page-numbers" href="" title="4">4</a></li>
<li><a class="page-numbers" href="" title="5">5</a></li>
<li><a class="page-numbers" href="" title="6">6</a></li>
<li><a class="page-numbers" href="" title="7">7</a></li>
<li><a class="next page-numbers" href="" title="2">></a></li>
</span>
</ul>
</div>
It not working, because it didnt remove <span class=”em-pagination”>
return apply_filters('em_paginate', '<span class="em-pagination" '.$data_atts.'>'.$string.'</span>');
And i dont know how to do that
Typo in my example. You have to close <li <a
Still havent found a solution yet, or i could try again to replace em-pagination into ‘pagination’ and add
.$data_atts.'> so it looks like .$data_atts.'><ul>
I used a different filter em_events_output_pagination, not em_paginate because it gives you the total number of events, the limit of events per page, the current page and the number of pages to show in the pagination link.
There is a small but in the current version of the Events Manager plugin, which is not passing the link template. So the reason it doesn’t work for you might be that?
In my case I don’t have the pages, but you can easily add those with a loop between the PREV and NEXT links, that iterates around the $page variable to display some pages before the current page and some pages after the current page, up to $pagesToShow
I finally get things working.
If anyone wants to add Twitter Bootstrap pagination for Events Manager use the following.
// Style EM pagination ussing Twitter Bootstrap (Responsive)
// We have to add Twitter Bootstrap classes (see stylesheet Bootstrap version 2.3.2)
function em_change_pagination($string){
// We want all the pagination links as a list <li>
// Add <li> tag before each <a> tag
if ( strpos($string,'<a') ){
$string = str_replace("<a","<li><a",$string);
}
if ( str_replace($string, "<li><a", "<strong><span")){
$string = str_replace("<strong><span","<li><a",$string);
}
// Add class pagination. We want all pagination links to be ordered as an unordered list, so we add <ul>
if ( str_replace($string,'<div class="em-pagination pagination" '.$data_atts.'><ul>', '<span class="em-pagination" '.$data_atts.'>') ){
$string = str_replace('<span class="em-pagination" '.$data_atts.'>','<div class="em-pagination pagination" '.$data_atts.'><ul>', $string);
}
// Add 'Next' button instead of >
if ( str_replace($string, "Next", ">")){
$string = str_replace(">","Next",$string);
}
// Add 'Previous' button, instead of <
if ( str_replace($string, "Previous", "<")){
$string = str_replace("<","Previous",$string);
}
// You also can add 'active' and 'disabled' states for the pagination // links. In that case you have to replace the 'current' class into
// 'active' (Note: class 'active' should be wrapped in <li // class="active"> //instead within the <span >
return $string;
}
add_filter('em_paginate','em_change_pagination',10,1);
thanks for the update and sharing the code.
Nice solution, although you are depending on the string format of the links. Be careful if it changes in a future version of Events Manager