2016-08-01 51 views
0

我想保留只有特色的內容,所以只有畫廊顯示在主頁上,所以我試圖禁用後循環,我可以輕鬆做到但我有在刪除分頁時遇到麻煩。刪除二十四個WordPress的主頁上的後循環,並保持分頁

下面是代碼

<?php 
    if (is_front_page() && twentyfourteen_has_featured_posts()) { 
     // Include the featured content template. 
     get_template_part('featured-content'); 
    } 
?> 

    <div id="primary" class="content-area"> 
     <div id="content" class="site-content" role="main"> 

     <?php 
      if (have_posts()) : 
       // Start the Loop. 
       while (have_posts()) : the_post(); 

        /* 
        * Include the post format-specific template for the content. If you want to 
        * use this in a child theme, then include a file called called content-___.php 
        * (where ___ is the post format) and that will be used instead. 
        */ 
        get_template_part('content', get_post_format()); 

       endwhile; 
       // Previous/next post navigation. 
       twentyfourteen_paging_nav(); 

      else : 
       // If no content, include the "No posts found" template. 
       get_template_part('content', 'none'); 

      endif; 
     ?> 

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

我也想嘗試在CSS

.home .post-37401 { 
display: none; 
} 

這是去除特定的帖子這樣做,但我想嘗試刪除所有帖子不與特色搞亂畫廊

+0

你想保持分頁嗎?請在這裏粘貼您的網站鏈接 –

+0

這對任何需要此功能的人都有效...... – user1576581

回答

0

這工作的人誰需要這個...

<?php 
    if (is_front_page() && twentyfourteen_has_featured_posts()) { 
     // Include the featured content template. 
     get_template_part('featured-content'); 
    } 
?> 

    <div id="primary" class="content-area"> 
     <div id="content" class="site-content" role="main"> 

     <?php 
      if (have_posts()) : 
       // Start the Loop. 
       while (have_posts()) : the_post(); 

        /* 
        * Include the post format-specific template for the content. If you want to 
        * use this in a child theme, then include a file called called content-___.php 
        * (where ___ is the post format) and that will be used instead. 
        */ 
$xpaged = (get_query_var('paged')) ? get_query_var('paged') : 1; 
global $paged; 

if ($paged > 1) {      
get_template_part('content', get_post_format()); 
} 
       endwhile; 
       // Previous/next post navigation. 
       twentyfourteen_paging_nav(); 

      else : 
       // If no content, include the "No posts found" template. 
       get_template_part('content', 'none'); 

      endif; 
     ?> 

     </div><!-- #content --> 
    </div><!-- #primary --> 
+0

每個人都沒有幫忙謝謝,這是一個社區,您應該儘可能地幫助您。 – user1576581

相關問題