Hello,
So I created a 2nd blog roll on my personal blog in a child theme but I am having trouble adding pagination to it. So for my first blog on main page I believe this is the code that is adding pagination at the bottom.
if (!function_exists(‘unblock_paging_nav’)) :
function unblock_paging_nav()
{
the_posts_pagination(array(
‘prev_text’ => is_rtl() ? ‘<i class=”bi bi-caret-right-fill”></i>’ : ‘<i class=”bi bi-caret-left-fill”></i>’,
‘next_text’ => is_rtl() ? ‘<i class=”bi bi-caret-left-fill”></i>’ : ‘<i class=”bi bi-caret-right-fill”></i>’,
‘before_page_number’ => ”
));
}
endif;
However on my child theme I have The Loop copied from the main blog to the second one almost exactly but pagination is not showing:
/* BLOG LAYOUT
====================================================*/
if (!function_exists(‘unblock_peiblog_styles’)) :
function unblock_peiblog_styles()
{
$unblock_blog_style = apply_filters(‘unblock_blog_style’, get_theme_mod(‘unblock_blog_style’, ‘classic-right’));
$peiCorner = new Wp_Query(array(
“posts_per_page” => 5,
“post_type” => “event”
));
// Start
if ($peiCorner->have_posts()) :
switch (esc_attr($unblock_blog_style)) {
case “list”:
echo ‘<div class=”column-wrapper blog-list”>’;
while ($peiCorner->have_posts()) : $peiCorner->the_post();
// Get the post summary
get_template_part(‘template-parts/content/content’, $unblock_blog_style !== ‘classic-right’ ? $unblock_blog_style : ”);
endwhile;
echo ‘</div>’;
// Blog navigation
unblock_paging_nav();
break;
You can see the Loop is calling `unblock_paging_nav()` at the end. This seems to work for main blog but not for second one.
Why is pagination not showing up? To see the staging site you can go here: [https://www.marcolapegna.com/1688559847124/])
The second blog is in the PEI corner tab.
Username: GenericLoginUser
Password: Cupcake$%124
The child and parent theme are here:[https://github.com/xVicissitudex/WordPress-Themes/tree/main])
The Main Loop is here:[https://github.com/xVicissitudex/WordPress-Themes/blob/main/unblock/layouts/blog-styles.php]) in main theme.
The Second Loop is here: [https://github.com/xVicissitudex/WordPress-Themes/blob/main/unblock-child/layouts/peiblog-styles.php]) on child theme.
[ad_2]