Suporte » Temas » Paginação – Página 2 não funciona

  • Pessoal…
    Estou com um problema, se alguém puder me auxiliar…
    Bem, a paginação é mostrada no blog, entretanto o link página 2 ao ser clicado, não acontece nada, continua mostrando os mesmos posts…
    Segue código:

    <?php
    /*
    Template Name: Blog
    */
    ?>
    <?php get_header(); ?>
    
    <div id="content">
    
        <?php if(have_posts()) while(have_posts()) : the_post(); ?>
    	<div id="post-<?php the_ID(); ?>" class="entry">
            <div class="thumbnail"><?php the_post_thumbnail('full'); ?></div>
            <h1 class="title"><?php the_title(); ?></h1>
            <div class="content page">
                <?php the_content(); ?>
                <?php wp_link_pages(array('before' => '<div class="page-link">'.__('Pages', 'cpotheme').':', 'after' => '</div>')); ?>
            </div>
        </div>
    	<?php endwhile; ?>
    
    	<?php if(get_query_var('paged')) $current_page = get_query_var('paged'); else $current_page = 1; ?>
        <?php query_posts("post_type=post&paged=$current_page&posts_per_page=4"); ?>
        <?php if(have_posts()): $feature_count = 0; ?>
    	<div class="previewlist">
    		<?php while(have_posts()): the_post(); ?>
    		<?php if($feature_count % 2 == 0 && $feature_count != 0) echo '<div class="separator"></div>'; ?>
    		<?php $feature_count++; ?>
    		<div class="preview<?php if($feature_count % 2 == 0 && $feature_count != 0) echo ' preview_second'; ?>" id="post-<?php the_ID(); ?>">
    			<?php if(has_post_thumbnail()): ?>
    			<div class="thumbnail">
    				<a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__('Permalink to %s', 'cpotheme'), the_title_attribute('echo=0')); ?>" rel="bookmark">
    					<?php the_post_thumbnail('portfolio'); ?>
    				</a>
    			</div>
    			<?php endif; ?>
    			<div class="date"><strong><?php echo get_the_date('d'); ?></strong><br /> <?php echo get_the_date('M'); ?></div>
    			<h2 class="title">
    				<a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__('Permalink to %s', 'cpotheme'), the_title_attribute('echo=0')); ?>" rel="bookmark"><?php the_title(); ?></a>
    			</h2>
    			<div class="byline">
    				<div class="author"><?php cpotheme_post_author(); ?></div>
    				<div class="category"><?php cpotheme_post_categories(); ?></div>
    				<div class="comments"><?php cpotheme_post_comments(); ?></div>
    			</div>
    			<div class="content">
    				<?php the_excerpt(); ?>
    				<br />
    				<a class="readmore" style="font-weight: bold;" href="<?php the_permalink(); ?>"><?php _e('Leia mais...', 'cpotheme'); ?></a>
    			</div>
    		</div>
    		<?php endwhile; ?>
    	</div>
    	<?php endif; ?>
    
        <?php cpotheme_post_pagination(); ?>
    </div>
    
    <?php get_footer(); ?>
Visualizando 2 respostas - 1 até 2 (de um total de 2)
  • Criador do tópico tayrine.espindola

    (@tayrineespindola)

    Adicionando mais informações…
    Caso possam me ajudar…
    No functions.php há esse trecho de código:

    //Paginates the post content
    function cpotheme_post_pagination(){
    	$query = $GLOBALS['wp_query'];
    	$posts_per_page = 7;
    	$current_page = max(1, absint($query->get('paged')));
    	$total_pages = max(1, absint($query->max_num_pages));
    
    	if(1 == $total_pages) return;
    
    	$request = $query->request;
    	$numposts = $query->found_posts;
    
    	$pages_to_show = 8;
    	$larger_page_to_show = 10;
    	$larger_page_multiple = 2;
    	$pages_to_show_minus_1 = $pages_to_show - 1;
    	$half_page_start = floor( $pages_to_show_minus_1/2 );
    	$half_page_end = ceil( $pages_to_show_minus_1/2 );
    	$start_page = $current_page - $half_page_start;
    
    	$end_page = $current_page + $half_page_end;
    
    	if(($end_page - $start_page) != $pages_to_show_minus_1)
    		$end_page = $start_page + $pages_to_show_minus_1;
    
    	if($end_page > $total_pages){
    		$start_page = $total_pages - $pages_to_show_minus_1;
    		$end_page = $total_pages;
    	}
    
    	if($start_page < 1)
    		$start_page = 1;
    
    	$out = '';
    
    	//First Page Link
    	if($current_page > 1){
    		$out .= '<a class="page first_page" href="'.esc_url(get_pagenum_link(1)).'">'.__('Primeira P&aacute;gina', 'cpotheme').'</a>';
    	}
    
    	//Previous Page Link
    	//$out .= get_previous_posts_link("Recientes");
    
    	//Show each page
    	foreach(range($start_page, $end_page) as $i){
    		if($i == $current_page){
    			$out .= "<span>$i</span>";
    		}else{
    			$out .= '<a class="page" href="'.esc_url(get_pagenum_link($i)).'">'.$i.'</a>';
    		}
    	}
    
    	//Next Page Link
    	//$out .= get_next_posts_link("Antiguos");
    
    	//Last Page Link
    	if($current_page < $total_pages){
    		$out .= '<a class="page last_page" href="'.esc_url(get_pagenum_link($total_pages)).'">'.__('&Uacute;ltima P&aacute;gina', 'cpotheme').'</a>';
    	}
    
    	$out = '<div id="pagination">'.$out.'</div>';
    
    	echo $out;
    }

    Estou com um problema parecido, quando clico na página 2, ele abre uma pagina em branco, e não carrega nada, não sei como resolver isso, uso o tema Mystique, Link do Site: http://centraldasnoticias.com/

Visualizando 2 respostas - 1 até 2 (de um total de 2)
  • O tópico ‘Paginação – Página 2 não funciona’ está fechado para novas respostas.