删除Twenty-14Wordpress主页上的帖子循环并保持分页


Remove post loop on homepage of Twenty Fourteen Wordpress and keep pagination

我试图只保留特色内容,所以主页上只显示图库,所以我试图禁用帖子循环,我可以很容易地做到这一点,但在删除时我很难保持分页。

这是代码

<?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;
}

这是为了删除一个特定的帖子,但我想尝试删除所有帖子,而不干扰功能库

这适用于任何需要它的人。。。

<?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 -->