Can anyone spot why the pagination links do not show on the page please?

                            $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
                            $args = array( 'post_type' => 'post','paged' => $paged, 'posts_per_page' => '6' );

                            $loop = new WP_Query( $args );
                            while ( $loop->have_posts() ) : $loop->the_post();

                                echo '<div class="nainv" data-equalizer-watch><div class="small-12 medium-4 columns"><div class="homePostThumb">';
                                echo '</div></div><div class="nainvtext"><a href="';
                                echo '"><h2 class="blogTitle">';
                                echo '</h2></a><div class="blogDate">';
                                the_time('l jS F Y');
                                echo '</div>';
                                echo '</div></div>';


        echo '</div>';
                   echo '<div class="blogPagination">';
                                    $nav = get_the_posts_pagination( array(
                                    'prev_text'          => __( '<i class="fa fa-chevron-left" aria-hidden="true"></i>', 'textdomain' ),
                                    'next_text'          => __( '<i class="fa fa-chevron-right" aria-hidden="true"></i>', 'textdomain' ),
                                    'screen_reader_text' => __( 'A' )
                                ) );

                                    $nav = str_replace('<h2 class="screen-reader-text">A</h2>', '', $nav);
                                    echo $nav;

                    echo '</div>';


What comes back in $nav when you call the function that (presumably) builds the pagination? Is the pagination code sent to the browser but just not displayed (i.e. in “view source” is it there, but just doesn’t show up?)"

Doesnt look like any code inserted into

so there is no pagination code it seems

This is WordPress code and pagination can be a bit tricky in WordPress. I think you might get some helpful responses from the WordPress category instead of PHP.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.