Compatibility with a bootstrap theme
-
Hi,
I am making a bootstrap theme, which you can find here: https://github.com/swashata/ipt-knowledgebase-theme-wp .
I intend to give inbuilt compatibility with your plugin. For that, I needed to convert the output of the plugin to some HTML compatible with bootstrap. This is the code I am using in my theme and so far it has worked good:
if ( function_exists( 'wp_pagenavi' ) && ! is_single() ) { $wp_pagenavi = wp_pagenavi( array( 'echo' => false, ) ); $wp_pagenavi = str_replace( array( "<div class='wp-pagenavi'>", '</div>', "<span class='pages'>", '</span>', "<span class='current'>", '<a href=', '</a>', "<span class='extend'>", /* translator: Translate it to the output of WP PageNavi for your lang */ __( '? First', 'ipt_kb' ), /* translator: Translate it to the output of WP PageNavi for your lang */ __( 'Last ?', 'ipt_kb' ), '?', '?', ), array( '<ul class="pagination">', '</ul>', '<li class="disabled"><span>', '</span></li>', '<li class="active"><span>', '<li><a href=', '</a></li>', '<li class="disabled"><span>', '<i class="glyphicon glyphicon-fast-backward"></i>', '<i class="glyphicon glyphicon-fast-forward"></i>', '<i class="glyphicon glyphicon-backward"></i>', '<i class="glyphicon glyphicon-forward"></i>', ), $wp_pagenavi ); echo $wp_pagenavi; return; }
Please see this image for the output: https://ipanelthemes.com/kb/files/2013/10/WP-PageNavi.png
Please let me know if I am doing it wrong or it can be done in a better way.
- The topic ‘Compatibility with a bootstrap theme’ is closed to new replies.