2013-09-24 3 views
0

특정 게시물 범주 만 표시하는 사용자 지정 인덱스 페이지를 만들었습니다. 그러나 페이지 매김은 사용자 정의 색인 페이지에서 작동하지 않습니다. 페이지 매김을 클릭하면 페이지 1 이외의 다른 페이지를 찾을 수 없습니다. 내 404 페이지로만 리디렉션됩니다.사용자 지정 페이지 인덱스에서 페이지 매김이 작동하지 않음

여기 여기 내 사용자 지정 인덱스 페이지

<?php 
/* 
Template Name: Funday 
*/ 
get_header(); ?> 


<div id="post" class="col span_8 clr"> 

<img src="<?php bloginfo('template_url'); ?>/images/articlebar.png" alt="article bar" id="logo" style="margin-bottom: 10px" /> 

<?php query_posts ($query_string . '&cat=funday'); ?> 
<?php 
if (have_posts()) : 
    while (have_posts()) : the_post(); 

     get_template_part('content', get_post_format()); 
    endwhile; 
endif; 
echo '<div class="clear"></div>'; 
wpex_pagination(); ?> 
</div><!-- .span_8 --> 

<?php 
get_sidebar(article); 
get_footer(); 

의 페이지 매김 기능을합니다.

<?php 

/** 
* Custom pagination function 
*/ 

if(! function_exists('wpex_pagination')) { 
    function wpex_pagination() { 
     global $wp_query; 
     $total = $wp_query->max_num_pages; 
     $big = 999999999; // need an unlikely integer 
     if($total > 1) { 
      if(!$current_page = get_query_var('paged')) 
       $current_page = 1; 
      if(get_option('permalink_structure')) { 
       $format = 'page/%#%/'; 
      } else { 
       $format = '&paged=%#%'; 
      } 
      echo paginate_links(array(
      'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big) )), 
      'format' => $format, 
      'current' => max(1, get_query_var('paged')), 
      'total' => $total, 
      'mid_size' => 3, 
      'end_size'  => 1, 
      'type' => 'list', 
      'prev_text' => '&laquo;', 
      'next_text' => '&raquo;', 
     )); 
} 
} 
} 



/** 
* Custom page entry pagination function 
* 
*/ 

function wpex_pagejump($pages = '', $range = 4) { 
    $showitems = ($range * 2)+1; 
    global $paged; 
    if(empty($paged)) $paged = 1; 

    if($pages == '') { 
     global $wp_query; 
     $pages = $wp_query->max_num_pages; 
     if(!$pages) { 
      $pages = 1; 
     } 
    } 

    if(1 != $pages) { 
     echo '<div class="post-navigation clearfix"><div class="alignleft">'; 
     previous_posts_link('&larr; ' . __('Newer Posts', 'wpex')); 
     echo '</div><div class="alignright">'; 
     next_posts_link(__('Older Posts', 'wpex') .' &rarr;'); 
     echo '</div></div>'; 
    } 
} 

답변

0
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 
query_posts ($query_string . '&cat=funday'.'&paged='.$paged); 

당신이 당신의 변수 코드를 사용자 정의해야 내가 전에 같은 문제가 있었이

0

을 시도하고 그냥이 코드

를 사용하여 고정

$paged = (get_query_var('page')) ? get_query_var('page') : 1; 
$args=array('post_type'=>'CUSTOM_POST_TYPE','posts_per_page'=>2,'paged'=>$paged); 
query_posts($args); 

페이지 지정 용이 코드의 사용

if (! function_exists('my_pagination')) : 
    function my_pagination() { 
     global $wp_query; 

     $big = 999999999; // need an unlikely integer 

     echo paginate_links(array(
      'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 
      'format' => '?paged=%#%', 
      'current' => max(1, get_query_var('paged')), 
      'total' => $wp_query->max_num_pages 
     )); 
    } 
endif; 

추가 정보

wordpress Static Page pagination

여기 봐
관련 문제