From 71d4231cbebb44800739cb50abac8b251977676f Mon Sep 17 00:00:00 2001 From: Philip Arthur Moore Date: Wed, 29 Apr 2015 08:42:12 +0700 Subject: [PATCH] Move template parts into their own dedicated folder and update Infinite Scroll to reflect this change. See #642. Props @leopuleo. --- archive.php | 4 ++-- inc/jetpack.php | 10 +++++++++- index.php | 4 ++-- page.php | 2 +- search.php | 4 ++-- single.php | 2 +- content-none.php => template-parts/content-none.php | 0 content-page.php => template-parts/content-page.php | 0 .../content-search.php | 0 .../content-single.php | 0 content.php => template-parts/content.php | 0 11 files changed, 17 insertions(+), 9 deletions(-) rename content-none.php => template-parts/content-none.php (100%) rename content-page.php => template-parts/content-page.php (100%) rename content-search.php => template-parts/content-search.php (100%) rename content-single.php => template-parts/content-single.php (100%) rename content.php => template-parts/content.php (100%) diff --git a/archive.php b/archive.php index b0a1971b..dc2b8d84 100644 --- a/archive.php +++ b/archive.php @@ -29,7 +29,7 @@ get_header(); ?> * 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. */ - get_template_part( 'content', get_post_format() ); + get_template_part( 'template-parts/content', get_post_format() ); ?> @@ -38,7 +38,7 @@ get_header(); ?> - + diff --git a/inc/jetpack.php b/inc/jetpack.php index 068f0f0f..78e7542c 100644 --- a/inc/jetpack.php +++ b/inc/jetpack.php @@ -13,7 +13,15 @@ function _s_jetpack_setup() { add_theme_support( 'infinite-scroll', array( 'container' => 'main', + 'render' => '_s_infinite_scroll_render', 'footer' => 'page', ) ); -} +} // end function _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 \ No newline at end of file diff --git a/index.php b/index.php index 59586c6f..fac92d74 100644 --- a/index.php +++ b/index.php @@ -26,7 +26,7 @@ get_header(); ?> * 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. */ - get_template_part( 'content', get_post_format() ); + get_template_part( 'template-parts/content', get_post_format() ); ?> @@ -35,7 +35,7 @@ get_header(); ?> - + diff --git a/page.php b/page.php index 2499c35d..e8b4e2e9 100644 --- a/page.php +++ b/page.php @@ -17,7 +17,7 @@ get_header(); ?> - + * If you want to overload this in a child theme then include a file * called content-search.php and that will be used instead. */ - get_template_part( 'content', 'search' ); + get_template_part( 'template-parts/content', 'search' ); ?> @@ -34,7 +34,7 @@ get_header(); ?> - + diff --git a/single.php b/single.php index a50a0464..f269842f 100644 --- a/single.php +++ b/single.php @@ -12,7 +12,7 @@ get_header(); ?> - + diff --git a/content-none.php b/template-parts/content-none.php similarity index 100% rename from content-none.php rename to template-parts/content-none.php diff --git a/content-page.php b/template-parts/content-page.php similarity index 100% rename from content-page.php rename to template-parts/content-page.php diff --git a/content-search.php b/template-parts/content-search.php similarity index 100% rename from content-search.php rename to template-parts/content-search.php diff --git a/content-single.php b/template-parts/content-single.php similarity index 100% rename from content-single.php rename to template-parts/content-single.php diff --git a/content.php b/template-parts/content.php similarity index 100% rename from content.php rename to template-parts/content.php