Wordpress page navi does not load next pages

0

I'm working on a theme that is not prepared to work with the <?php wp_pagenavi(); ?> function. I installed the WP-PageNavi plugin, saved with the initial settings and entered the function in the code as shown below.

The paging buttons appeared and have enough posts to be shown on page 2, but when I click the 2 page, it does not load the posts from the 2 page, it opens the 2 page with the same posts as the 1 page.

Do you need to enter some code?

                <?php if(have_posts()): while(have_posts()): the_post(); ?>
                            <?php
            $datas_new_count = 0;
            $myposts = get_posts('posts_per_page=12&orderby=date&order=DESC&category_name='.$nomeCategoria);
            foreach($myposts as $post) :
        ?>

            <div id="" class="col-md-3 col-sm-12 col-xs-12">

                <article>

                    <div class='img-box-cat'>
                    <a href="<?php echo get_permalink(); ?>" >
                        <img src="<?php echo get_img_destaque(get_the_ID()); ?>" alt="<?php the_title();?>" title="<?php the_title();?>">
                    </a>
                    </div>
                    <a href="<?php echo get_permalink(); ?>">
                        <div class="title-box-cat" >
                        <h2>
                        <?php echo abreviaString(get_the_title(),50,'...');?>

                        </h2>
                        </div>

                    </a>
                    <a href="<?php the_permalink(); ?>" class="botao medio"><i class="fa fa-eye"></i> Continue Lendo</a>
                </article>

            </div><!-- ### Final da div  ### -->

            <?php 
                    $datas_new_count++;

                    if(($datas_new_count % 4) == 0 ){
                         echo '<div class="clearfix"></div>';
                    }

             ?>

        <?php endforeach; ?>            
                <?php endwhile; else : ?>
                <?php
                    if ( function_exists('yoast_breadcrumb') ) {
                        yoast_breadcrumb('
                            <p id="breadcrumbs">','</p>
                        ');
                    }
                ?>
    <br>

                    <p><i class="fa fa-info-circle"></i> Nenhum post encontrado nesta categoria.</p>
                <?php endif; ?>

            <?php endif ?>

                <?php wp_pagenavi(); ?>

            </div>
    
asked by anonymous 08.02.2018 / 18:06

0 answers