分页不适用于自定义类别

I'm having trouble with showing pagination on the archive.php page for WordPress, I have 2 queries, one is for 2 posts and other one is for 12, but my pagination isnt workign at all, i'm using wpbegginer pagination

<?php
                        $featured[] = '';
                        $args1 = array(
                          'cat'                 => get_query_var( 'cat' ),
                          'posts_per_page'      => 2,
                          'ignore_sticky_posts' => 2,
                          'order'               => 'DESC',
                          'orderby'             => 'date'
                        );

                        $query = new WP_Query( $args1 );?>
                        @while($query->have_posts()) @php $query->the_post() @endphp
        <?php the_title() ?>
             <?php  $featured[] = get_the_ID();  ?>
                        @endwhile
                        @php wp_reset_postdata(); @endphp

    //second query

     <?php $cat_id = get_query_var( 'cat' );?>
            <?php $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; ?>
            @php $args2 = array (
            'post__not_in' => $featured,
            'posts_per_page' => 12,
            'ignore_sticky_posts' => 1,
            'post_type' => 'post',
            'paged' => $paged,
            'cat' => $cat_id
             ); @endphp

     <?php
                $temp = $wp_query;
                $wp_query = null;
                $wp_query = new WP_Query();
                $wp_query->query( $args2 );

                while ($wp_query->have_posts()) : $wp_query->the_post();?>
    <?php the_title(); ?>
 <?php endwhile; ?>
            <?php
            $wp_query = null;
            $wp_query = $temp;  // Resetujemo wp_query
            ?>
              @php wp_reset_postdata(); @endphp
          <?php echo wpbeginner_numeric_posts_nav(); ?>
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐