Suporte » Plugins » Pagenavi não muda de página

  • Resolvido brunoxavier

    (@brunoxavier)


    http://www.insultovertical.com.br

    Por favor olhem meu problema. Ao final la na paginação, quando você clica para ir para a página 2 o link vai porém continua aparecendo a primeira página.

    Vi um post aqui no fórum com um código, porem ele não funcionou.

    Alguem pode me ajudar?

Visualizando 12 respostas - 1 até 12 (de um total de 12)
  • O seu codigo deve estar com algo parecido com isso:

    <?php query_posts('cat=5&showposts=5'); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    Aí é só trocar:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
    
    <?php query_posts('cat=5&showposts=5&paged=$paged'); ?>
    
    <?php if (have_posts()) : ?>
    
    <?php while (have_posts()) : the_post(); ?>

    Vê se funciona… pra maioria aqui funcionou, pra mim infelizmente não 🙁

    Criador do tópico brunoxavier

    (@brunoxavier)

    Não funciona comigo tb não =/

    Posta aqui o código da sua home.php. Se não houver, da index.php.

    Criador do tópico brunoxavier

    (@brunoxavier)

    <?php get_header(); ?>

    <center><img src=”http://i936.photobucket.com/albums/ad201/insultovertical/GARAGEMBANNER.jpg”&gt;</center>

    <div id=”body”> <!– Body [sidebar, posts] –>

    <div id=”content”> <!– Contents –>

    <?php
    $post = $wp_query->post;
    $id = $wpdb->get_var(“SELECT term_id FROM $wpdb->terms WHERE slug='” .get_option(‘gallery-category’) .”‘”);

    ?>

    <?php
    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    query_posts(‘cat=-‘ .$id .”); ?>
    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <div class=”postMain png”> <!– Post Block Wrapper –>

    <div class=”post”> <!– Post Contents –>

    <h2>” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h2>
    <h3><?php the_time(‘F jS, Y’) ?> | escrito por <?php the_author() ?></h3>
    <?php the_content(‘CLIQUE AQUI OU NA IMAGEM PARA VER O CONTEÚDO COMPLETO’); ?>

    <div class=”postMeta”><?php the_tags(‘Tags: ‘, ‘, ‘, ‘
    ‘); ?> Posted in <?php the_category(‘, ‘) ?>
    Comentários: <?php comments_popup_link(‘Seja o primeiro »’, ‘1 Comentário »’, ‘% Comentários »’); ?></div>

    </div> <!– / Post Contents End –>

    </div> <!– / Post Block Wrapper End –>
    <!– / Post Footer for image –>
    <div style=”clear:both”>
    </div><div class=”postFoot png”></div>
    <?php endwhile; ?>

    <?php else : ?>

    <?php endif; ?>

    </div> <!– / Contents End –>

    <?php get_sidebar(); ?>
    <div class=”clr”></div>

    </div> <!– / Body [sidebar, posts] End –>
    <center><?php if(function_exists(‘wp_pagenavi’)) { wp_pagenavi(); } ?></center>
    </div> <!– / Inner Wrapper [contains Floor Image] End –>
    <?php get_footer(); ?>

    </div> <!– / Main Container End –>

    </div> <!– / Outermost Block End –>

    </body>
    </html>

    Ta ai minha home.php

    Substitua:
    query_posts('cat=-' .$id .''); ?>
    .
    Por:
    query_posts('cat=-' .$id .'&paged='.$paged); ?>
    .
    micalopes:
    No seu código, troque as aspas simples do query_posts por aspas duplas.

    Criador do tópico brunoxavier

    (@brunoxavier)

    Muito obrigado Renato.
    Deu certinho.

    Pra mim ainda não funcionou 🙁

    Coloque o seu código aqui também.

    Agora funcionou…
    Eu tinha esquecido de um query_post que estava no início do código!!!!

    Obrigada!!!!

    Olá, estou com o mesmo erro, porém o código é diferente, olhem só:

    <?php $homepage=false;
    if (is_home()) {
    	if (get_option('glow_duplicate') == 'false') {
    		$args=array(
    		   'showposts'=>get_option('glow_homepage_posts'),
    		   'post__not_in' => $ids,
    		   'paged'=>$paged,
    		   'category__not_in' => get_option('glow_exlcats_recent'),
    		);
    	} else {
    		$args=array(
    		   'showposts'=>get_option('glow_homepage_posts'),
    		   'paged'=>$paged,
    		   'category__not_in' => get_option('glow_exlcats_recent'),
    		);
    	};
    	$homepage=true;
    
    query_posts($args);
    } else {
    	if (is_archive()) $post_number = get_option('glow_archivenum_posts');
    	if (is_search()) $post_number = get_option('glow_searchnum_posts');
    	if (is_tag()) $post_number = get_option('glow_tagnum_posts');
    	if (is_category()) $post_number = get_option('glow_catnum_posts');
    	global $query_string; query_posts($query_string . "&showposts=$post_number&paged=$paged");
    }
    
    if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <?php $thumb = get_post_meta($post->ID, 'Thumbnail', $single = true); ?>
    <?php if (($thumb == '') && ($glow_grab_image == 'on')) $thumb = catch_that_image(); ?>
    		<div class="post blogstyle<?php if (!($homepage)) echo(" indexpage"); ?>">
    			<div class="new-post">
    				<?php if (get_option('glow_postinfo1_show') == 'on') include(TEMPLATEPATH . '/includes/postinfo.php'); ?>
    				<h2><a href="<?php the_permalink() ?>" title="<?php printf(__ ('Ir para %s', 'Glow'), get_the_title()) ?>"><?php the_title(); ?></a></h2>
                    <?php if (get_option('glow_thumbnails') == 'on') { ?>
    				<?php if ($thumb != '') { ?>
    				<a href="<?php the_permalink() ?>" title="<?php printf(__ ('Ir para %s', 'Glow'), get_the_title()) ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $thumb; ?>&h=156&w=156&zc=1" alt="<?php echo(the_title()); ?>" class="thumbnail alignleft" /></a>
                   <?php };}; ?>
    				<p><?php the_content(""); ?></p>
    				<a href="<?php the_permalink() ?>" class="readmore"><span><?php _e('Leia mais','Glow'); ?></span></a>
    				<div class="clear"></div>
    			</div> <!-- end new-post -->
    		</div> <!-- end post -->
    <?php endwhile; ?>
    
    <div class="clear"></div>
    
    	<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
    	else { ?>
    	<div class="pagination">
    		<div class="alignleft"><?php next_posts_link(__('&laquo; Older Entries','Glow')) ?></div>
    		<div class="alignright"><?php previous_posts_link(__('Next Entries &raquo;', 'Glow')) ?></div>
    	</div>
    	<?php } ?>
    <?php else : ?>
    	<?php include(TEMPLATEPATH . '/includes/no-results.php'); ?>
    <?php endif; wp_reset_query(); ?>

    E, observando a barra de endereço, acontece o seguinte:

    http://www.site.com/blog/page/2/ e não funciona.

    Porém, ao trocar os “permalinks” http://www.site.com/blog/?paged=2/ aí funciona.

    Tô maluco nisso.

    Olá! Visitei seu site e vi que o problema já está resolvido. Poderia dizer aqui como resolveu?

    Olá pessoal ! Sou novo no WordPress e estou com dificuldade em configurar um simples paginador e um limitador de posts por página.
    Já pesquisei bastante e tenho noção query_posts(‘showposts=2’);.

    Desde já mui grato.

    Meu index.php é simples e segue:

    `<?php get_header(); ?>

    <div id=”content” class=”narrowcolumn”>

    <!– inicio do post –>

    <?php

    if (have_posts()) : while (have_posts()) : the_post();
    if (is_home()) if (in_category(‘6’)) continue; // Não mostra a categoria ID=6 na home

    // fim do post

    require(‘post.php’); endwhile;

    ?>

    <!– inicio do navigation –>

    <div class=”navigation”>
    <?php wp_pagenavi(); ?>
    </div>

    <!– fim do navigation –>

    <?php else : ?>

    <!– inicio do post –>

    <h2 class=”center”>Sem resultados</h2>
    <p class=”center”><?php _e(“Desculpe, mas você está procurando por algo que não está aqui.”); ?></p>
    <?php include (TEMPLATEPATH . “/searchform.php”); ?>

    <!– fim do post –>

    <?php endif; ?>

    </div>

    <?php get_sidebar(); ?>

Visualizando 12 respostas - 1 até 12 (de um total de 12)
  • O tópico ‘Pagenavi não muda de página’ está fechado para novas respostas.