2016-10-24 4 views
0

저는 Wordpress에서 블로그를 만들고있어 포스트 페이지 매김이 나타나지 않습니다. 게시물 목록이 제대로 표시되지만 게시물이 5 개 (8 개) 있고 페이지 매김이 작동하지 않습니다.Wordpress 페이지 매김이 루프에서 보이지 않습니다.

<?php 
if (have_posts()): while (have_posts()) : the_post(); ?> 
    <div class="all-post"> 
     <?php 
     $args = array('category' => ''); 
     $myposts = get_posts($args); 
     foreach ($myposts as $post) : setup_postdata($post); ?> 
      <div class="post"> 
       <div class="post-thumbnail"> 
        <?php the_post_thumbnail(); ?> 
       </div> 
       <div class="post-details"> 
        <div class="post-meta"> 
         <span class="date"><?php the_time('j M, Y'); ?></span> 
         <!-- Categories --> 
         <span class="categories"> 
          <?php 
          $category_ids = get_all_category_ids(); 
          ?><?php 
          $args = array('orderby' => 'slug', 'parent' => 0); 
          $categories = get_categories($args); 
          foreach ($categories as $category) 
          { 
           echo '<a href="' . get_category_link(
             $category->term_id 
            ) . '" rel="bookmark" class="category">' . $category->name . '' . $category->description . '</a>'; 
          } ?> 
         </span> 
        </div> 
        <h2 class="post-title"> 
         <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> 
        </h2> 
        <a href="<?php the_permalink(); ?>" class="read-more">Read More</a> 
       </div> 
      </div> 
     <?php endforeach; 
     wp_reset_postdata(); ?> 
    </div> 
<?php endwhile; ?> 
    <?php next_posts_link('Older posts'); ?> 
    <?php previous_posts_link('Newer posts'); ?> 
<?php else: ?> 
<?php endif; ?> 

답변

0

당신은 아마 어떤 posts_per_page 값을 설정하지 않은 당신은, 전체 웹 사이트 블로그/아카이브 페이지에 그것을 modifiy 읽기 설정 페이지에서 posts_per_page 값을 수정하려면 기본값은 5입니다.

$args 배열에서, 같은 folow 수정 :

$args = array(
    'posts_per_page'=> -1, // unlimited 
    'category' => '' 
); 
$posts = get_posts($args); 

나는 당신의 주어진 코드를 모르기 때문에 내가 (왜 내가 이것을 달성하기 위해 두 가지 방법을 제공하는 것이) 내 대답에 신중 해요, 메인 루프 $ args가 수정 인 경우.

그럼에도 불구하고 이것이 도움이되기를 바랍니다.

관련 문제