Suporte » Temas » Paginação funciona em umas páginas, noutras não.

  • Resolvido adesoares

    (@adesoares)


    Olá, já estive por aqui há bastante tempo, falando justamente de paginação. Cá estou novamente, com um novo tema, e confuso com esta situação.

    Meu site é http://www.emfococursos.com.br/ Acessem!

    Vejam que a categoria “noticias” possue 10 artigos. Coloquei, para melhor exemplificar este teste, 2 artigos por página. Acontece que não segue para a página 2.

    Em contrapartida, ao fazer uma busca (por exemplo “inss”) aparecem vários artigos (também de 2 e 2 por página) e a paginação funciona corretamente.

    Pelo que vi na informação de “Página não Encontrada” o arquivo com erro é um do tema (defaultindex.php). Para efeito de comparação, colocarei aqui o código deste arquivo e de outro (blogstylecat.php)

    defaulindex.php (acho que o erro tá aqui)

    <div id=”post-top”>

    </div> <!– end post-top –>

    <div id=”main-area-wrap”>
    <div id=”wrapper”>
    <div id=”main” class=”noborder”>
    <?php
    if (is_archive() || is_search() || is_tag()) {
    if (is_archive()) $post_number = get_option(‘enews_archivenum_posts’);
    if (is_search()) $post_number = get_option(‘enews_searchnum_posts’);
    if (is_tag()) $post_number = get_option(‘enews_tagnum_posts’);
    global $query_string; query_posts($query_string . “&showposts=$post_number&paged=$paged”);
    }
    ?>
    <?php $i = 0; if (have_posts()) : while (have_posts()) : the_post();
    $i++; ?>
    <?php if(function_exists(‘wp_email’)) { email_link(); } ?>

    <?php $width = 291;
    $height = 114;
    $titletext = get_the_title();
    $thumbnail = get_thumbnail($width,$height,”,$titletext,$titletext);
    $thumb = $thumbnail[“thumb”]; ?>

    <div class=”mainpost-wrap<?php if (($i%2)<>0) echo (” fst”) ?>”>
    <h2>” title=”<?php printf(__(‘Link Permanente para %s’,’eNews’), get_the_title()) ?>”><?php truncate_title(60); ?></h2>
    <p><?php truncate_post(119); ?></p>

    <?php if ( $thumb <> ” ) { ?>
    ” title=”<?php printf(__(‘Link Permanente para %s’,’eNews’), get_the_title()) ?>”>
    <?php print_thumbnail($thumb, $thumbnail[“use_timthumb”], $titletext, $width, $height); ?>

    <?php }; ?>

    <div class=”info”><?php _e(‘postado dia’,’eNews’) ?>: <?php the_time(get_option(‘enews_date_format’)) ?>
    <?php _e(‘autor’,’eNews’) ?>: <?php echo get_the_author(); ?></div>
    </div> <!– end mainpost-wrap–>
    <?php endwhile; ?>

    <?php if( function_exists(‘wp_pagenavi’) ) { wp_pagenavi(); }
    else { ?>
    <p class=”pagination”>
    <?php next_posts_link(__(‘« Posts Anteriores’,’eNews’)) ?>
    <?php previous_posts_link(__(‘Próximos Posts »’,’eNews’)) ?>
    </p>
    <?php } ?>

    <?php else : ?>

    <!–If no results are found–>
    <div id=”post-content”>
    <h1><?php _e(‘Nenhum Resultado encontrado’,’eNews’) ?></h1>
    <p><?php _e(‘A página que você procurou não foi encontrada. Redefina sua pesquisa ou use a navegação acima para localizar o post.’,’eNews’) ?></p>
    </div>
    <!–End if no results are found–>

    <?php endif; ?>
    <?php if (is_archive() || is_search() || is_tag()) wp_reset_query(); ?>
    </div> <!– end main –>

    Agora vejam o blogstylecat.php

    <div id=”post-top”>

    </div> <!– end post-top –>

    <div id=”main-area-wrap”>
    <div id=”wrapper”>
    <div id=”main” class=”noborder”>
    <?php query_posts(“cat=$cat&showposts=$enews_catnum_posts&paged=$paged”); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h1 class=”post-title”>” title=”<?php printf(__(‘Link Permanente para %s’,’eNews’), get_the_title()) ?>”><?php the_title() ?></h1>
    <span class=”meta-comments”><?php comments_popup_link(__(‘0 comentários’,’eNews’), __(‘1 comentário’,’eNews’), ‘% ‘.__(‘comentários’,’eNews’)); ?></span>

    <?php if (get_option(‘enews_postinfo’) <> ”) { ?>
    <div class=”post-meta”>
    <div class=”post-meta-bottom”>
    <p><?php _e(‘Postado’,’eNews’) ?> <?php if (in_array(‘author’, get_option(‘enews_postinfo’))) { ?> <?php _e(‘por’,’eNews’) ?> <span class=”author”><?php the_author() ?></span><?php }; ?><?php if (in_array(‘date’, get_option(‘enews_postinfo’))) { ?><?php _e(‘, dia’,’eNews’) ?> <?php the_time(get_option(‘enews_date_format’)) ?><?php }; ?><?php if (in_array(‘categories’, get_option(‘enews_postinfo’))) { ?><?php _e(‘, em’,’eNews’) ?> <?php the_category(‘, ‘) ?><?php }; ?><?php if (in_array(‘comments’, get_option(‘enews_postinfo’))) { ?> | <?php comments_popup_link(__(‘0 comentários’,’eNews’), __(‘1 comentário’,’eNews’), ‘% ‘.__(‘comentários’,’eNews’)); ?><?php }; ?></p>
    </div>
    </div>
    <?php }; ?>

    <div id=”post-content”>

    <?php if (get_option(‘enews_thumbnails’) == ‘on’) { ?>

    <?php $width = 127;
    $height = 127;
    $classtext = ‘thumbnail alignleft’;
    $titletext = get_the_title();

    $thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext);
    $thumb = $thumbnail[“thumb”]; ?>

    <?php if($thumb <> ”) { ?>
    <?php print_thumbnail($thumb, $thumbnail[“use_timthumb”], $titletext, $width, $height, $classtext); ?>
    <?php }; ?>

    <?php }; ?>
    <?php the_content(); ?>
    <?php edit_post_link(__(‘Edit this post’,’eNews’)); ?>
    </div> <!– end post-content –>
    <br class=”clearfix”/>
    <?php endwhile; ?>

    <?php if( function_exists(‘wp_pagenavi’) ) { wp_pagenavi(); }
    else { ?>
    <p class=”pagination”>
    <?php next_posts_link(__(‘« Posts Anteriores’,’eNews’)) ?>
    <?php previous_posts_link(__(‘Próximos Posts »’,’eNews’)) ?>
    </p>
    <?php } ?>

    <?php else : ?>
    <!–If no results are found–>
    <div id=”post-content”>
    <h1><?php _e(‘Nenhum Resultado Encontrado’,’eNews’) ?></h1>
    <p><?php _e(‘A página que você procurou não foi encontrada. Redefina sua pesquisa ou use a navegação abaixo para localizar o post.’,’eNews’) ?></p>
    </div>
    <!–End if no results are found–>
    <?php endif; ?>
    <?php wp_reset_query(); ?>

    </div> <!– end main –>

    Por favor, ajudem-me!
    Obrigado!

Visualizando 1 resposta (de um total de 1)
  • Criador do tópico adesoares

    (@adesoares)

    Pessoal, talvez este post sirva para outros usuários.
    Eu não entendo de programação, apenas faço analogias e comparações.
    Mas futuco muito bem o sistema.
    .
    Comparando os 2 arquivos acima, eu vi que há algo a mais no defaulindex.php. Eu eliminei o comando/argumento abaixo:

    <?php
    if (is_archive() || is_search() || is_tag()) {
    if (is_archive()) $post_number = get_option(‘enews_archivenum_posts’);
    if (is_search()) $post_number = get_option(‘enews_searchnum_posts’);
    if (is_tag()) $post_number = get_option(‘enews_tagnum_posts’);
    global $query_string; query_posts($query_string . “&showposts=$post_number&paged=$paged”);
    }
    ?>

    E inseri este aqui:

    <?php query_posts(“cat=$cat&showposts=$enews_catnum_posts&paged=$paged”); ?>

    Pronto, resolvido!
    Não sei por quê os editores inseriram aqueles argumentos, nem sei como isso funciona, tecnicamente falando. Mas tá aí, deu certo!

    Uma semana em poucos minutos de boa dedução.

Visualizando 1 resposta (de um total de 1)
  • O tópico ‘Paginação funciona em umas páginas, noutras não.’ está fechado para novas respostas.