Suporte » Problemas no funcionamento » Paginação não funciona utilizando permalink

  • Olá.
    Tenho uma página personalizada no chamada fotos.
    Nela a paginação com o wp_pagenavi não funciona com url amigável. Quando mudo de página da erro 404, pois não é encontrado o endereço: “/fotos/page/2/”
    Estou utilizando permalink “/%category%/%postname%/”. Se eu mudar para a formatação padrão ele funciona normalmente.

    Vejam o código:

    function.php:

    function post_type_fotos() {
    	register_post_type( 'fotos',
                    array('label' => __('Fotos'),
                                 'public' => true,
                                 'show_ui' => true,
                                 'taxonomies' => array( 'fotos-categories'),
                                 'supports' => array(
                                 			'title',
                                            'thumbnail',
                                            'editor',
                                            'revisions',
    										'custom-fields',
    										'comments')
                                    )
                          );
    	add_rewrite_rule('projects/page/([0-9]+)/?$', 'index.php?pagename=projects&paged=$matches[1]', 'top');
    	register_taxonomy_for_object_type('post_tag', 'fotos');
    }
    add_action('init', 'post_type_fotos');

    fotos.php:

    <section>
                <header>
                    <h1>Fotos</h1>
                </header>
                <?php $loop = new WP_Query( array( 'post_type' => 'fotos', 'posts_per_page' => 2, 'paged' => get_query_var('paged') ) ); ?>
                <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
                    <div class="agrupaEvento">
                        <div class="fotoCapa left">
                            <a href="<?php the_permalink() ?>" class="bordaBottom">
                            <?php the_post_thumbnail('fotos-image', array( 'alt' => get_the_title(), 'class' =>"cover", 'title' => get_the_title() . "")); ?></a>
                        </div>
    
                        <h2><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                        <div class="metaInfos"><?php meta('data-evento'); ?> | <?php meta('cidades'); ?></div>
                    </div>
    			<?php endwhile; ?>
            </section>
    
            <aside>
               <?php if(function_exists('wp_pagenavi')) : ?><?php if(function_exists('wp_pagenavi')) { wp_pagenavi(array('query'=>$loop)); } ?><?php endif; ?>
            </aside>

    Alguém pode me ajudar?
    Obrigado.

  • O tópico ‘Paginação não funciona utilizando permalink’ está fechado a novas respostas.