| Server IP : 159.69.118.108 / Your IP : 216.73.216.200 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu-4gb-fsn1-1 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 13:53:54 UTC 2025 aarch64 User : root ( 0) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/clients/deborahrobinson.net/wp-content/themes/debbie/ |
Upload File : |
<?php
/* ------------------------------------------------------------------*/
/* PAGINATION */
/* ------------------------------------------------------------------*/
// http://stackoverflow.com/questions/38939212/wordpress-paginate-links-how-to-use-it/
// http://callmenick.com/post/custom-wordpress-loop-with-pagination
// http://stackoverflow.com/questions/5699911/get-text-between-html-tags
// http://wordpress.stackexchange.com/questions/126080/changing-pagination-list-class
$total_pages = $the_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));
$pages = paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => 'page/%#%',
'current' => $current_page,
'total' => $total_pages,
'prev_text' => __('«'),
'next_text' => __('»'),
'type' => 'array',
));
if (is_array($pages)) {
echo '<nav><ul class="pagination">';
foreach ($pages as $page) {
$dom = DOMDocument::loadHTML($page);
//discard white space
$dom->preserveWhiteSpace = false;
$found = $dom->getElementsByTagName('a'); // here u use your desired tag
if ($found->length === 0) {
$found = $dom->getElementsByTagName('span');
}
if ($current_page == $found->item(0)->nodeValue) {
echo "<li class='active'>$page</li>";
} else {
echo "<li>$page</li>";
}
}
echo '</ul></nav>';
}
}
?>