Created
July 5, 2020 16:22
-
-
Save mustafix/cf74cbb94dba7b5a3b343993d16d4609 to your computer and use it in GitHub Desktop.
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
/*------------------------------------------------------- | |
functions.php | |
--------------------------------------------------------*/ | |
function bulletin_paginate_links($mid_size=3){ | |
global $wp_query; | |
$big = 999999999; // need an unlikely integer | |
$links = paginate_links(array( | |
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), | |
'format' => '?paged=%#%', | |
'current' => max(1, get_query_var('paged')), | |
'total' => $wp_query->max_num_pages, | |
'type' => 'array', | |
'prev_next' => true, | |
'prev_text' => '<i class="fa fa-angle-double-left"></i> newer posts', | |
'next_text' => 'older posts <i class="fa fa-angle-double-right"></i>', | |
'mid_size' => $mid_size | |
)); | |
if ($links) { | |
foreach ($links as $link) { | |
if (strpos($link, "current") !== false){ | |
echo '<li class="page-item disabled active"><a class="page-link" href="#">' . $link . "<a/></li>\n"; | |
} | |
else{ | |
$link = str_replace('page-numbers','page-link',$link); | |
echo '<li class="page-item">' . $link . "</li>\n"; | |
} | |
} | |
} | |
} | |
/*------------------------------------------------------- | |
index.php | |
--------------------------------------------------------*/ | |
<?php luoyang_paginate_links(); ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment