Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

wordpress custom post pagination show same post on all pages

Here is my code. Plesae helps me to fix this issue. Actually, I used a page template on WordPress. I try the many articles but do not get exactly what I want

<?php
            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
            $args = array(
                'post_type' => 'case_studiess',
                'post_status' => 'publish',
                'posts_per_page' => 10
            );
            
            $wp_query = new WP_Query( $args );
        
            if ($wp_query->have_posts()) :
        
                while ($wp_query->have_posts()) :
                    $wp_query->the_post();
            ?>
                    <article data-aos="fade-down" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                        <?php
                        if (has_post_thumbnail()) :
                            the_post_thumbnail();
                        endif;
                        ?>
                        <header class="entry-header">
                            <h1 class="entry-title"><?php the_title(); ?></h1>
                        </header>
                        <div class="entry-content">
                            <?php the_excerpt(); ?>
                            <a href="<?php the_permalink(); ?>">Read More</a>
                        </div>
                    </article>
            <?php
                endwhile;
                wp_pagenavi(
                    array(
                        'query' => $wp_query,
                    )
                );
            endif;
        ?>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Please use this query (I’ve added ‘paged’=>$paged)

        $args = array(
            'post_type' => 'case_studiess',
            'post_status' => 'publish',
            'posts_per_page' => 10,
            'paged'=>$paged
        );
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading