2012-12-28 8 views
3

좋아요. 이걸로 내 머리를 찢어 내고 있어요. 아주 간단하고 얼굴에 나를 빤히 쳐다 보지만 그냥 볼 수 없어요. 본질적으로 무슨 일이 일어나고 있는지는 내 페이지 매김이 작동하지 않는다는 것입니다. 나는 wp_pagenavi 플러그인을 사용한다. (이미 체크 된 이슈는 아니다.) 페이지 매김의 링크리스트를 제공한다. 모든 코드가 정상적으로 작동합니다. 실제로 모든 코드가 수행해야하는 작업을 수행합니다. 문제는 "2"또는 "3"과 같은 페이지 매김 링크를 클릭하면 해당 페이지 매김 (예 : www.yousitehere.com/somepage/page/2)으로 이동하려고 시도하지만 대신 사이트가 현재 페이지를 다시로드합니다. /2 쪽.Wordpress 페이지는 페이지가 매겨지지 않습니다

어딘가에 페이지가 페이지 매김을해야한다는 것을 알지 못하므로 페이지가로드되기 전에 페이지의 무언가를 무시합니다. (reset_query가 아님).

이것은 Wordpress 사이트입니다. 불행히도 사이트 링크를 보여 드릴 수 없으므로 누군가를 제안 해 주시면 더 힘들어집니다.

여기 내 코드

<div id="content" class="clearfix"> 
<div id="main" class="col960 left first clearfix" role="cont_detail"> 
<?php if (have_posts()) : while (have_posts()) : the_post(); 
    $id = get_the_ID(); 
    $array = metadata($id); 
?> 
    <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="cont_detail" > 
     <header> 
      <div id="header_bg_top"></div> 
      <div id="header_bg"> 
       <?php if($array['custom_facebook'] !="" && $array['custom_twitter'] !="" && $array['custom_linkedin'] != ""&& $array['custom_website'] != "" && $array['custom_blog'] != "" && $array['custom_email'] != ""){?> 
       <div class="social_link_container"> 
        <div class="width"> 
         <?php if(isset($array['custom_facebook']) && $array['custom_facebook'] !=""){?> 
         <a href="http://www.facebook.com/<?php echo $array['custom_facebook'];?>" target="_new"><img src="<?php echo get_template_directory_uri(); ?>/images/author-facebook.png"></a> 
         <?php } 
         if(isset($array['custom_twitter']) && $array['custom_twitter'] !=""){?> 
         <a href="http://www.twitter.com/<?php echo $array['custom_twitter'];?>" target="_new"><img src="<?php echo get_template_directory_uri(); ?>/images/author-twitter.png"></a> 
         <?php } 
         if(isset($array['custom_linkedin']) && $array['custom_linkedin'] !=""){?> 
         <a href="http://www.linkedin.com/<?php echo $array['custom_linkedin'];?>" target="_new"><img src="<?php echo get_template_directory_uri(); ?>/images/author-in.png"></a> 
         <?php } 
         if(isset($array['custom_website']) && $array['custom_website'] !=""){?> 
         <a href="http://<?php echo $array['custom_website'];?>" target="_new"><img src="<?php echo get_template_directory_uri(); ?>/images/author-web.png"></a> 
         <?php } 
         if(isset($array['custom_blog']) && $array['custom_blog'] !=""){?> 
         <a href="http://<?php echo $array['custom_blog'];?>" target="_new"><img src="<?php echo get_template_directory_uri(); ?>/images/author-blog.png"></a> 
         <?php } 
         if(isset($array['custom_email']) && $array['custom_email'] !=""){?> 
         <a href="mailto:<?php echo $array['custom_email'];?>"><img src="<?php echo get_template_directory_uri(); ?>/images/author-email.png"></a><?php }?> 
        </div> 
       </div> 
       <?php } ?> 
       <h1 class="cont_detail_title" itemprop="headline"><?php the_title(); ?></h1> 
       <?php if(isset($array['custom_description']) && $array['custom_description'] !="") 
       { 
        ?> 
        <span class="title_description"><?php echo $array['custom_description']; ?></span> 
       <?php 
       } 
       ?> 
      </div><!-- header-bg --> 
     </header> <!-- end article header --> 
     <section> 
      <div class="content-left"> 
       <?php if(isset($array['featured_thumb']) && $array['featured_thumb'] !="") 
        { 
        ?> 
        <div class="cont_detail_image"> 
         <?php print_thumbnail($array['featured_thumb'], "medium");?> 
        </div> 
       <?php 
       } 
       ?> 
      </div> 
      <div class="content-right"> 
       <?php the_content(); ?> 
      </div> 
     </section> <!-- end article section --> 

    </article> <!-- end article --> 
    <?php endwhile; ?>   
    <?php else : ?> 
     <article id="post-not-found"> 
      <header> 
       <h1>Not Found</h1> 
      </header> 
      <section class="post_content"> 
       <p>Sorry, but the requested resource was not found on this site.</p> 
      </section> 
      <footer>  
      </footer> 
     </article> 
    <?php endif;   
    wp_reset_query(); 
//Sort queries, most viewed, alphabetical, date   

    echo '<section><div id="content_bg" class="group">'; 
    $row_num = 1;    
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;      
    if($_GET['sort'] == 'date') { 
     $sortOrder = getSortOrder($_GET['dsort_order']); 
     $meta_queries[] = array(    
      'key' => 'custom_authorid', 
      'value' => $post->ID, 
      'compare' => 'LIKE', 
      ); 
      query_posts(array(
      'post__not_in' => array($post->ID), 
      'post_type' => 'post', 
      'meta_query' => $meta_queries, 
      'order'=>$sortOrder, 
      'orderby'=> 'date', 
      'posts_per_page' => 9, 
      'paged' => $paged 
      )); 
    } 
    elseif($_GET['sort'] == 'alpha') { 
     $sortOrder = getSortOrder($_GET['asort_order']); 
     $meta_queries[] = array(    
      'key' => 'custom_authorid', 
      'value' => $post->ID, 
      'compare' => 'LIKE', 
      ); 
      query_posts(array(
      'post__not_in' => array($post->ID), 
      'post_type' => 'post', 
      'meta_query' => $meta_queries, 
      'order'=>$sortOrder, 
      'orderby'=> 'title', 
      // adding posts_per_page, set to 9 might be different then global preference 
      'posts_per_page' => 9, 
      'paged' => $paged 
      )); 
     } 
    elseif($_GET['sort'] == 'mviewed') { 

     } 
    else{ 
     $meta_queries[] = array(            
      'key' => 'custom_authorid', 
      'value' => $post->ID, 
      'compare' => 'LIKE', 
      ); 
      query_posts(array(
      'post__not_in' => array($post->ID), 
      'post_type' => 'post', 
      'posts_per_page' => 9, 
      'meta_query' => $meta_queries, 
      'paged' => $paged 
      )); 
     } 

     ?> 
    <div class="paginate_nav"> 
     <?php wp_pagenavi(); // use the page navi function ?> 
     <div class="sort_nav"> 
      <?php contrPaginationLinks($sortOrder) ?> 
     </div><!--sort_nav--> 
    </div><!--paginate_nav-->  
    <?php 
     if($_GET['sort'] == 'mviewed') { 

     } 
     else{ 
      if (have_posts()) : while (have_posts()) : the_post();           
       $item = metadata($post->ID); 
       $containsVideos = false; 
       foreach ($item['cat'] as $value) { 
        if (strpos($value->cat_name,'Videos') !== false) { 
         $containsVideos = true; 
        } 
       } 
      ?> 
       <div class="story-container" > 
        <div class="story_left"> 
         <div class="story_image"> 
          <input type="hidden" name="vidID" value="<?php echo $item['media_link']; ?>" /> 
          <div class="about_latest_image <?php echo $item['media_link']; ?>"> 
           <a href="<?php echo $item['link']; ?>"> 
             <?php 
             print_thumbnail($item['featured_thumb'],"thumbnail", $item['youtube_link'], $item['vimeo_link'], $item['media_link']);  
             ?> 
            <?php if($containsVideos == true){echo '<span class="videoIndicator"></span>';} ?> 
           </a>   
          </div> 
         </div>  
         <?php if($_GET['sort'] == 'date'){ ?> 
          <div class="story_view"> 
           <?php echo $item['date']; ?> 
          </div> 
          <?php } ?> 
        </div> 
       <div class="story_title"> 
        <a href="<?php echo $item['link']; ?>" title="<?php echo $item['title']; ?>"> 
         <span class="story_title"><?php echo $item['title']; ?></span> 
        </a> 
       </div> 
       <?php if(isset($item['custom_description']) && $item['custom_description'] !="") { 
       ?> 
        <div class="story_description"><?php echo $item['custom_description']; ?></div> 
       <?php 
       } 
       ?> 
      <div class="story_content"></div>       
     </div> 
     <?php endwhile; ?> 
     <?php else : ?> 
      <h1><?php _e("No Posts Yet", "hooplahatheme"); ?></h1> 
      <p><?php _e("Sorry, What you were looking for is not here.", "hooplahatheme"); ?></p> 
     <?php endif; 
     } // end display else default 
     echo '</div></section>'; 
     // 
     // reset query after display is done    
     // 
     wp_reset_query(); 
     ?> 
     <footer> 
     </footer> <!-- end article footer --> 
</div> <!-- end #main -->  


업데이트

그것은 내가 다음 단계를 찾기 위해 노력하고있는 무슨이다 발생하는 302 리디렉션이 있음을 밝혀입니다.

+0

라이브 사이트 링크를 공유 할 수 있습니까? 우리가 문제를 확인할 수 있습니다. – NewUser

답변

2

비슷한 질문을 가진 사람이라면 누구나 간단합니다. 워드 프레스에서는 기본적으로 단일 게시물 페이지를 페이지 매김 할 수 없습니다. 그냥 페이지의 루트 URL로 다시 리디렉션됩니다. 당신이이 작업을 중지 할 필요가 여기에 http://wordpress.org/support/topic/home-pagination-page2-redirect-to-a-post

+0

'/ pagename/page/1'이 아닌'/ pagename/page/2'가 작동하도록 할 수 있습니다. 그것이 이상한 설정인지) –

3

크리스토퍼의 대답은 아마도 대부분의 사람들이 작동 볼 수있는이 당신에 대한 추가 정보를 원하시면

add_filter('redirect_canonical','pif_disable_redirect_canonical'); 

function pif_disable_redirect_canonical($redirect_url) { 


if(is_singular() && in_category('PLACE CAT ID HERE')) { 
    $redirect_url = false; 
} 
return $redirect_url; 
} 

functions.php 당신의 주제에이 추가됩니다.

하지만 ..

당신은 또한 /pagename/page/1에 영향을 미치는에서 리디렉션을 중지하려면이 도움이됩니다 :

add_filter('redirect_canonical', 'my_redirect_canonical', 10, 2); 
function my_redirect_canonical($redirect_url, $requested_url) { 
    $do_redirect = true; 
    if(preg_match('/page/',$requested_url)){ 
    $do_redirect = false; 
    } 
    return $do_redirect; 
} 

here 발견.

관련 문제