I wrote this code:
<div class="col-12">
<div class="pagination d-flex justify-content-center mt-5">
<!-- <a href="#" class="rounded">«</a>
<a href="#" class="active rounded">1</a>
<a href="#" class="rounded">2</a>
<a href="#" class="rounded">3</a>
<a href="#" class="rounded">4</a>
<a href="#" class="rounded">5</a>
<a href="#" class="rounded">6</a>
<a href="#" class="rounded">»</a> -->
<?php
$total_pages = $loop->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var('paged'));
$base_url = get_pagenum_link(1);
$paged_url = add_query_arg('paged', '%#%', $base_url); // Replace %%% with actual page number
echo paginate_links(array(
'base' => $paged_url,
'format' => '%#%',
'current' => $current_page,
'total' => $total_pages,
'prev_text' => __('« prev'),
'next_text' => __('next »'),
));
}
wp_reset_postdata();
?>
</div>
</div>
In this code, the commented out part is actually how the active page number inside pagination should look like, but I am having no ideas on how I can manage this issue.