2016-09-06 13 views
0

私はこのような特定のページの子ページを表示します。番号付き改ページページWordpressの

$args = array(
'post_type'  => 'page', 
'post_parent' => $post->ID, 
'posts_per_page' => 3, 
'order'   => 'ASC', 
'post_status' => 'publish', 
'child_of' => $post->ID 
); 

$parent = new WP_Query($args); 

if ($parent->have_posts()) { ?> 

<?php while ($parent->have_posts()) : $parent->the_post(); ?> 


     <div class="bloc-page"> 
      <h1><?php the_title(); ?></h1> 
     </div> 


<?php endwhile; ?> 

私が欲しいのはたった3つのポストの各ページに、番号が付けナビゲーションです。しかし、私はそれをどうやって行うのか分からず、私は多くの解決策を試しましたが、何も効果がありませんでした。

あなたの返信ありがとうございます!

答えて

0

あなたwhileループの終わりはライン以下を追加した直後:

<?php 
$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' => $parent->max_num_pages 
)); 
?> 

さらにヘルプが必要な場合は、公式WordPressのページネーションのドキュメントhereをお読みください。

0

どのような解決策をとったのですか? wp_reset_postdata();を試しましたか?

関連する問題