Last active
June 12, 2019 10:11
-
-
Save cjmosure/d542f5f5d468855cb52effab5e9e2c95 to your computer and use it in GitHub Desktop.
WP-PageNavi - Bootstrap 4
This file contains 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
@whoisandywhite TYYYY!