Move template parts into their own dedicated folder and update Infinite Scroll to reflect this change. See #642. Props @leopuleo.

This commit is contained in:
Philip Arthur Moore 2015-04-29 08:42:12 +07:00
parent ff6337943b
commit 71d4231cbe
11 changed files with 17 additions and 9 deletions

View File

@ -29,7 +29,7 @@ get_header(); ?>
* If you want to override this in a child theme, then include a file * If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/ */
get_template_part( 'content', get_post_format() ); get_template_part( 'template-parts/content', get_post_format() );
?> ?>
<?php endwhile; ?> <?php endwhile; ?>
@ -38,7 +38,7 @@ get_header(); ?>
<?php else : ?> <?php else : ?>
<?php get_template_part( 'content', 'none' ); ?> <?php get_template_part( 'template-parts/content', 'none' ); ?>
<?php endif; ?> <?php endif; ?>

View File

@ -13,7 +13,15 @@
function _s_jetpack_setup() { function _s_jetpack_setup() {
add_theme_support( 'infinite-scroll', array( add_theme_support( 'infinite-scroll', array(
'container' => 'main', 'container' => 'main',
'render' => '_s_infinite_scroll_render',
'footer' => 'page', 'footer' => 'page',
) ); ) );
} } // end function _s_jetpack_setup
add_action( 'after_setup_theme', '_s_jetpack_setup' ); add_action( 'after_setup_theme', '_s_jetpack_setup' );
function _s_infinite_scroll_render() {
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/content', get_post_format() );
}
} // end function _s_infinite_scroll_render

View File

@ -26,7 +26,7 @@ get_header(); ?>
* If you want to override this in a child theme, then include a file * If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/ */
get_template_part( 'content', get_post_format() ); get_template_part( 'template-parts/content', get_post_format() );
?> ?>
<?php endwhile; ?> <?php endwhile; ?>
@ -35,7 +35,7 @@ get_header(); ?>
<?php else : ?> <?php else : ?>
<?php get_template_part( 'content', 'none' ); ?> <?php get_template_part( 'template-parts/content', 'none' ); ?>
<?php endif; ?> <?php endif; ?>

View File

@ -17,7 +17,7 @@ get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?> <?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?> <?php get_template_part( 'template-parts/content', 'page' ); ?>
<?php <?php
// If comments are open or we have at least one comment, load up the comment template // If comments are open or we have at least one comment, load up the comment template

View File

@ -25,7 +25,7 @@ get_header(); ?>
* If you want to overload this in a child theme then include a file * If you want to overload this in a child theme then include a file
* called content-search.php and that will be used instead. * called content-search.php and that will be used instead.
*/ */
get_template_part( 'content', 'search' ); get_template_part( 'template-parts/content', 'search' );
?> ?>
<?php endwhile; ?> <?php endwhile; ?>
@ -34,7 +34,7 @@ get_header(); ?>
<?php else : ?> <?php else : ?>
<?php get_template_part( 'content', 'none' ); ?> <?php get_template_part( 'template-parts/content', 'none' ); ?>
<?php endif; ?> <?php endif; ?>

View File

@ -12,7 +12,7 @@ get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?> <?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'single' ); ?> <?php get_template_part( 'template-parts/content', 'single' ); ?>
<?php the_post_navigation(); ?> <?php the_post_navigation(); ?>