2012-11-20 2 views
0

카테고리 별 게시물을 표시하도록 설정된 보관 페이지가 있습니다. 그러나 카테고리 페이지에서 특정 카테고리의 게시물 만 표시하는 대신 모든 게시물을 표시합니다. 예를 들어 here을 참조하십시오.Wordpress 카테고리 템플릿이 특정 카테고리 게시물 대신 모든 카테고리의 게시물을 표시합니다.

다음은 archive.php 페이지에서 사용하고있는 코드입니다. 부적절한 루프 사용을 알고 있지만 어떻게 수정해야할지 모르겠습니다. 도와 주셔서 감사합니다.

<?php get_header(); ?> 
    <div id="content"> 
     <div id="inner-content" class="wrap clearfix"> 
      <h1 class="blogTitle" style="margin:10px 0 3px 0;">Blog Title</h1> 
       <nav class="blogNav" role="navigation"> 
        <?php bones_blog_nav(); // Adjust using Menus in Wordpress Admin ?> 
       </nav> 
       <div id="main" class="eightcol first clearfix" role="main"> 
        <div class="catwhiteBg"> 
         <?php if (is_category()) { ?> 
         <h1 class="catTitle"> 
          <span><?php _e("", "bonestheme"); ?></span> <?php single_cat_title(); ?> 
         </h1> 
         <?php echo category_description($category_id); ?> 

         <?php } elseif (is_author()) { ?> 
          <div class="authorTop"> 
           <?php 
           $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); 
           ?> 
           <div class="author-pic"><?php echo get_avatar($curauth->user_email, '80'); ?></div> 
           <div class="author-name"><span style="font-weight: 200; color: #575757;">POSTS BY:</span> 
             <?php echo $curauth->first_name; ?> <?php echo $curauth->last_name; ?> 
           </div> 
           <div class="author-bio"><?php echo $curauth->description; ?></div> 
           <a href="<?php echo $curauth->twitter; ?>" title="Twitter"><div class="author-twitter"><span>twitter</span></div></a> 
          </div> 

         <?php } elseif (is_day()) { ?> 
          <h1 class="archive-title h2"> 
           <span><?php _e("Daily Archives:", "bonestheme"); ?></span> <?php the_time('l, F j, Y'); ?> 
          </h1> 

         <?php } elseif (is_month()) { ?> 
          <h1 class="archive-title h2"> 
           <span><?php _e("Monthly Archives:", "bonestheme"); ?></span> <?php the_time('F Y'); ?> 
          </h1> 

         <?php } elseif (is_year()) { ?> 
          <h1 class="archive-title h2"> 
           <span><?php _e("Yearly Archives:", "bonestheme"); ?></span> <?php the_time('Y'); ?> 
          </h1> 
         <?php } ?> 
        </div> 

        <div class="psts"> 
         <?php 
         global $wp_query; 

         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 

         if (get_query_var('paged')) { 

         $paged = get_query_var('paged'); 

         } elseif (get_query_var('page')) { 

         $paged = get_query_var('page'); 

         } else { 

         $paged = 1; 

         } 

         query_posts(array('posts_per_page' => '8','paged'=>$paged)); 
         ?> 

         <?php 
         $count = 1; 

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

         <div class="sixcol small pst<?php if ((isset($count)) && ($count % 2 == 0)) { echo ' last';} // same logic to add class of last to last item in row of two ?>" id="post-<?php the_ID(); ?>"> 
          <article id="post-<?php the_ID(); ?>" role="article"> 
           <div class="thumb-wrapper mobile"> 
            <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php if(has_post_thumbnail()) { $image_src = wp_get_attachment_image_src(get_post_thumbnail_id(),'post-thumb'); echo '<img src="' . $image_src[0] . '" width="100%" class="post-thumb" />'; } ?></a> 

            <header class="post-thumb-header"> 
             <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><h2 class="post-title"><?php the_title(); ?></h2></a> 
            </header> <!-- end article header --> 
            <p class="meta"><?php the_category(', '); ?></p> 
           </div> 

           <section class="mobile-content"> 
            <?php the_excerpt(); ?> 
           </section> 
          </article> <!-- end article --> 
         </div> 

         <?php $count++; ?> 

         <?php endwhile; ?> 

         <nav class="wp-prev-next"> 
          <?php echo rb_pagination(); ?> 
         </nav> 
        </div> <!-- end .psts -->           
       </div> <!-- end #main --> 

      <?php get_sidebar(); // sidebar 1 ?> 

     </div> <!-- end #inner-content --> 

    </div> <!-- end #content --> 

<?php get_footer(); ?> 

답변

1

난 당신이 줄을 원래 쿼리를 무시한다고 생각 :

query_posts(array('posts_per_page' => '8','paged'=>$paged)); 

이이 라인을 교체하고, 나에게 결과를 알려 수 있습니까?

query_posts(array('posts_per_page' => '8','paged'=>$paged, 'cat' => $category_id)); 
:

global $query_string; 
query_posts($query_string . "&posts_per_page=8&paged=$paged"); 

는이 시도에 실패하면

관련 문제