1

フロントページに2つのループがあり、どちらもページネーションを使用しています。これを機能させるためのコードを見つけることができました。以下に貼り付けました。paginate_linksに投稿の総数を表示させないようにすることはできますか?現在、次のようになっています:1、2、3...526。次へ。私が好む:1、2、3...次へ

現在のコード:

            // Courtesy of Boone Gorges

            $paged1 = isset( $_GET['paged1'] ) ? (int) $_GET['paged1'] : 1;
            $paged2 = isset( $_GET['paged2'] ) ? (int) $_GET['paged2'] : 1;

            // Custom Loop with Pagination 1
            // http://codex.wordpress.org/Class_Reference/WP_Query#Usage
            $args1 = array(
                'paged'          => $paged1, // http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters
                'posts_per_page' => 1,
                'category_name'  => 'wod'
            );
            $query1 = new WP_Query( $args1 );

            while ( $query1->have_posts() ) : $query1->the_post();
                echo '<h4>';
                the_date();
                echo '</h4>';
                the_content();
                echo '<hr>';
            endwhile;

            // http://codex.wordpress.org/Function_Reference/paginate_links
            $pag_args1 = array(
                'format'   => '?paged1=%#%',
                'current'  => $paged1,
                'total'    => $query1->max_num_pages,
        'show_all' => False,
                'add_args' => array( 'paged2' => $paged2 ),
        'prev_text' => 'Next',  
            'next_text' => 'Prev'
            );
            echo paginate_links( $pag_args1 );
        ?>
4

1 に答える 1