Tuesday, September 27, 2022
HomeWordPress DevelopmentPagination not engaged on customized submit sort archive

Pagination not engaged on customized submit sort archive


The pagination will not be working. In settings > studying I’ve set ‘3’ posts for weblog pages present at most. On my customized submit sort archive web page, I’ve 9 posts displaying and I’ve this code. Unsure what I’m lacking to indicate the pagination, can somebody assist?

<?php $loop = new WP_Query( 

    array( 
        'post_type' => 'which_ev',
        'paged' => $paged,
        'category_name' => 'which-ev',
        'posts_per_page' => -1,
        'tag__not_in' => array(11, 12),
    ));

    if ( $loop->have_posts() ) :
        whereas ( $loop->have_posts() ) : $loop->the_post(); ?>

        <div class="col-md-4">
            <div class="featured-post" onclick="location.href="https://wordpress.stackexchange.com/questions/409906/<?php the_permalink();?>";">
                <?php if ( has_post_thumbnail() ) : ?>
                    <a href="<?php the_permalink(); ?>">
                        <img src="<?php the_post_thumbnail_url();?>" alt="<?php the_title();?>" class="post-image">
                    </a>
                <?php endif; ?>
                <?php 
                    if ( has_post_thumbnail() ) {
                        $attachment_image = wp_get_attachment_url( get_post_thumbnail_id() );
                        echo '<hyperlink rel="preload" as="picture" href="' . esc_attr( $attachment_image ) . '">';    
                    } 
                ?>
                <div class="post-intro">
                    <span class="post-category">
                        Which EV?
                    </span>
                    <h2 class="post-title">
                        <?php the_title();?>
                    </h2>
                    <a href="<?php the_permalink();?>" class="main-btn"> Learn The Story <img src="<?php bloginfo('template_directory');?>/property/photographs/evee-01.svg"></a>
                </div>
            </div>
        </div>

        <?php endwhile;
            if (  $loop->max_num_pages > 1 ) : ?>
            <div id="nav-below" class="navigation">
                <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Earlier', 'area' ) ); ?></div>
                <div class="nav-next"><?php previous_posts_link( __( 'Subsequent <span class="meta-nav">&rarr;</span>', 'area' ) ); ?></div>
            </div>

    <?php endif;
endif;
wp_reset_postdata();?>

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments