2016-12-14 11 views
0

"abc_author"という1人の投稿を表示したい。 if節を使用して検証を使用していますが、ページ1が空白(他の投稿がスキップされているため)、2ページ目(他の投稿がスキップされているため)私は6ページに希望の投稿を得る。 verbosa_pagination()のコメントはページ区切りを非表示にしていますが、開始ページは空白になります。 私はWordPressの新機能ですが、別のプラグインも試していますが、特定のページが、私はいくつかの理由でデフォルトのブログ投稿にしたい)特定の投稿者の投稿をフィルタリングする

<?php if (have_posts()) : ?> 

     <div id="content-masonry"> 
      <?php /* Start the Loop */ 
      while (have_posts()) : the_post(); 
         if(get_the_author()=='abc_author') 
      { 
      get_template_part('content/content', get_post_format()); 
      } 
      endwhile; ?> 
     </div> <!-- content-masonry --> 
     <?php verbosa_pagination(); 

    else : 
     get_template_part('content/content', 'notfound'); 
    endif; 

答えて

0

whileループの前にこのコードを試してください。

<?php query_posts(array('author' => 'your author ID')); ?> 

参考:ここにもhttps://developer.wordpress.org/reference/functions/query_posts/#usage

+0

はこれについて解決の質問ですhttp://wordpress.stackexchange.com/questions/123920/wp-query-get-posts-by-specific-author-idsいくつかのログインした著者のうちの1人 – Gazi

+0

@Jomal John、ありがとう、それは私のために働く:) – kashif

+0

私の喜び.. :) –

関連する問題