1
resposta

Problemas com paginação PHP/Wordpress

Boa tarde, tenho um script que quando clico na paginação numero dois, ele muda a URL porém não muda os dados retornados, segue o print e o código:

https://uploaddeimagens.com.br/imagens/sem_titulo-png--22516

<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
 * The template for displaying archive pages
 */
$us_layout = US_Layout::instance();
// Needed for canvas class
$us_layout->titlebar = ( us_get_option( 'titlebar_archive_content', 'all' ) == 'hide' ) ? 'none' : 'default' ;
get_header();


//$categoria = get_produto_cat(get_the_ID());
//$thumb = get_field('thumb', 'tipo-material_'.$categoria->term_id, 'tipo-material' );
//$terms = get_the_terms( get_the_ID(), 'tipo-material');
//$thumb = get_field('es-material-categoria-imagem', 'tipo-material');

?>

<div class="l-titlebar imgsize_initial size_large color_alternate"><div class="l-titlebar-img loaded" data-img-width="1920" data-img-height="322"></div><div class="l-titlebar-h"><div class="l-titlebar-content"><h1 itemprop="headline"><?php _e('Download Center', 'us') ?></h1></div></div></div>

<!-- MAIN -->
<div class="l-main">
    <div class="l-main-h i-cf">
        <a class="w-btn style_raised color_white icon_atleft bt-soft positivo mobile-main-bts filtro-sidebar-download-center" >
            <span class="w-btn-label"><?php _e('Filtrar', 'us') ?></span>
            <span class="ripple-container"></span>
        </a>
        <aside class="l-sidebar at_left sidebar-download-center" itemscope="itemscope" itemtype="https://schema.org/WPSideBar">
            <h3><?php _e('Filtrar Materiais', 'us') ?></h3>
            <?php dynamic_sidebar( 'us_widget_area_coluna_download_center' ) ?>

            <form role="search" method="get" class="search-form search-material" action="<?php echo home_url( '/' ); ?>">
                <label>
                    <input type="search" class="search-field" placeholder="<?php _e('Buscar material...', 'us') ?>" value="<?php echo get_search_query() ?>" name="s" title="<?php _e('Buscar material...', 'us') ?>" />
                </label>
                <input type="submit" class="search-submit" />
                <input type="hidden" name="post_type" value="material" />
                <input type="hidden" name="lang" value="<?php echo ICL_LANGUAGE_CODE; ?>" />
            </form>
        </aside>

        <main class="l-content" itemprop="mainContentOfPage">
            <section class="l-section">
                    <div class="vc_col-sm-12 wpb_column animate_afr d2 animate_start shortcode-material download-center">
                    <div class="vc_column-inner">
                    <div class="wpb_text_column ">
                    <div class="wpb_wrapper">
                    <div class="g-cols wpb_row offset_medium vc_inner ">

                    <?php 

                    global $wp_query;
                    if($wp_query->found_posts == 0)
                        $resultado = __('Nenhum item encontrado', 'us');
                    else if($wp_query->found_posts > 1){ 
                        $resultado = $wp_query->found_posts . ' ' . __('itens', 'us');
                    }
                    else {
                        $resultado = $wp_query->found_posts . ' ' . __('item', 'us');
                    } ?>

                    <div class="count-terms"><span><?php echo  $resultado ?></span></div>
                        <?php if (have_posts()) : while ( have_posts() ) : the_post(); ?>
                        <?php $terms = get_the_terms( get_the_ID(), 'tipo-material' );
                            $readmore = __("Saiba Mais", "us");
                            if($terms) {
                                foreach ( $terms as $term ) :
                                    $readmore = get_field('es-material-categoria-texto', 'tipo-material_'.$term->term_id, 'tipo-material' );
                                    break; 
                                endforeach;                                
                                if(!$readmore)
                                    $readmore = __("Saiba Mais", "us");
                            }

                         ?>
                            <div class="vc_col-sm-4 wpb_column">
                                <div class="shortcode-material-interno estilo-bloco modo-tax">
                                        <div class="img">
                                            <div class="checker">
                                                <span class=""><input id="material-check" class="material-check" type="checkbox" data-id="<?php the_ID(); ?>"><label for="material-check"></label></span>
                                                <?php if(get_field("es-material-lp")) : ?>
                                                    <div class="w-btn-wrapper align_center bt-area">
                                                        <a class="w-btn style_flat color_white icon_none bt-soft secundario" target="_blank" href="<?php the_permalink(); ?>">
                                                            <span class="w-btn-label"><?php echo $readmore ?></span>
                                                            <span class="ripple-container"></span>
                                                        </a>
                                                    </div>
                                                <?php endif; ?>
                                            </div>
                                        <?php 
                                            $args = array('number' => '1');

                                            if($terms) {
                                                foreach ( $terms as $term ) : ?>
                                                    <?php 
                                                        $thumb = get_field('es-material-categoria-imagem', 'tipo-material_'.$term->term_id, 'tipo-material' );
                                                    ?>
                                                    <?php if ( has_post_thumbnail() ): ?>
                                                        <img src="<?php echo get_the_post_thumbnail_url($post_id, 'img-material'); ?>">
                                                    <?php else: ?>
                                                        <?php if($thumb) : ?>
                                                                <img src="<?php echo $thumb ?>">
                                                            <?php else: ?>
                                                                <img src="http://52.8.62.99/index/wp-content/uploads/2016/12/img-materiais-default-download.png">
                                                            <?php endif; ?>
                                                    <?php endif; ?>
                                                    </div>
                                                    <?php echo '<div class="taxonomia">'.$term->name.'</div>'; ?>
                                                    <?php break; ?>
                                            <?php endforeach; ?>

                                            <?php } else {
                                            ?>
                                            <img src="http://52.8.62.99/index/wp-content/uploads/2016/12/img-materiais-default-download.png">
                                            </div>
                                            <?php
                                            } ?>

                                        <div class="middle">
                                            <h4><?php the_title() ?></h4>
                                            <div class="desc"><?php the_field("es-material-resumo"); ?></div>
                                    </div>
                                </div>
                            </div>
                        <?php endwhile; ?>
                        <div class="g-pagination"><?php
                            the_posts_pagination( array(
                            'prev_text' => '<',
                            'next_text' => '>',
                            'mid_size' => 3,
                            'before_page_number' => '<span>',
                            'after_page_number' => '</span>',
                            ) );
                        ?></div>
                        <?php endif; ?>
                    </div>
                    </div>
                    </div>
                    </div>
                    </div>

            </section>
        </main>
    </div>
</div>
<div class="popup-form download-baixar">
    <div class="l-main-h i-cf">
        <span class="download-quantidade"></span>
        <a class="w-btn style_flat color_white icon_atright three bt-soft secundario bt-baixar" href="#">
            <i class="fa fa-icone-baixo-secundario"></i>
            <span class="w-btn-label"><?php _e('Fazer Download', 'us') ?></span>
            <span class="ripple-container"></span>
        </a>
        <div class="download-fechar"><?php _e('LIMPAR', 'us') ?></div>
    </div>
</div>
<?php //echo do_shortcode('[menu_form tag="mais-info" titulo="Mais Informações" subtitulo="Preencha o formulário e fale conosco"][contact-form-7 id="508" title="Mais Informações"][/menu_form]'); ?>
<?php get_template_part( 'partials/_snackbars' ) ?>
<?php
get_footer();
1 resposta

Duplicado com: https://cursos.alura.com.br/forum/topico-problemas-com-paginacao-php-wordpress-42824