-
-
Save lincolnlemos/f3ace22b79bb9cdc108e7a3306573476 to your computer and use it in GitHub Desktop.
WP-PageNavi - Bootstrap 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Clean up pagination | |
*/ | |
add_filter( 'wp_pagenavi', __NAMESPACE__ . '\\gc_pagination', 10, 2 ); | |
function gc_pagination($html) { | |
$out = ''; | |
$out = str_replace('<div','',$html); | |
$out = str_replace('class=\'wp-pagenavi\'>','',$out); | |
$out = str_replace('<a','<li class="page-item"><a class="page-link"',$out); | |
$out = str_replace('</a>','</a></li>',$out); | |
$out = str_replace('<span class=\'current\'','<li class="page-item active"><span class="page-link current"',$out); | |
$out = str_replace('<span class=\'pages\'','<li class="page-item"><span class="page-link pages"',$out); | |
$out = str_replace('<span class=\'extend\'','<li class="page-item"><span class="page-link extend"',$out); | |
$out = str_replace('</span>','</span></li>',$out); | |
$out = str_replace('</div>','',$out); | |
return '<ul class="pagination">'.$out.'</ul>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment