loop template

This commit is contained in:
James Koster 2014-08-18 09:33:18 +01:00
parent bd5fbff3f9
commit 468136e0b1
5 changed files with 43 additions and 49 deletions

View file

@ -77,20 +77,7 @@ get_header(); ?>
?>
</header><!-- .page-header -->
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Format-specific template for the content.
* 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() );
?>
<?php endwhile; ?>
<?php storefront_paging_nav(); ?>
<?php get_template_part( 'loop' ); ?>
<?php else : ?>

View file

@ -12,9 +12,9 @@
* @see storefront_scripts()
* @see storefront_header_widget_region()
*/
add_action( 'after_setup_theme', 'storefront_setup' );
add_action( 'widgets_init', 'storefront_widgets_init' );
add_action( 'wp_enqueue_scripts', 'storefront_scripts' );
add_action( 'after_setup_theme', 'storefront_setup' );
add_action( 'widgets_init', 'storefront_widgets_init' );
add_action( 'wp_enqueue_scripts', 'storefront_scripts' );
add_action( 'storefront_before_content', 'storefront_header_widget_region', 10 );
/**
@ -45,12 +45,18 @@ add_action( 'storefront_footer', 'storefront_credit', 20 );
* @see storefront_popular_products()
* @see storefront_on_sale_products()
*/
add_action( 'homepage', 'storefront_page_content', 10 );
add_action( 'homepage', 'storefront_page_content', 10 );
add_action( 'homepage', 'storefront_product_categories', 20 );
add_action( 'homepage', 'storefront_recent_products', 30 );
add_action( 'homepage', 'storefront_featured_products', 40 );
add_action( 'homepage', 'storefront_popular_products', 50 );
add_action( 'homepage', 'storefront_on_sale_products', 60 );
add_action( 'homepage', 'storefront_popular_products', 50 );
add_action( 'homepage', 'storefront_on_sale_products', 60 );
/**
* Loop
* @see storefront_paging_nav()
*/
add_action( 'storefront_loop_after', 'storefront_paging_nav', 10 );
/**
* Extras

View file

@ -18,20 +18,7 @@ get_header(); ?>
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Format-specific template for the content.
* 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() );
?>
<?php endwhile; ?>
<?php storefront_paging_nav(); ?>
<?php get_template_part( 'loop' ); ?>
<?php else : ?>

28
loop.php Normal file
View file

@ -0,0 +1,28 @@
<?php
/**
* The loop template file.
*
* Included on pages like index.php, archive.php and search.php to display a loop of posts
* Learn more: http://codex.wordpress.org/The_Loop
*
* @package storefront
*/
do_action( 'storefront_loop_before' );
while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Format-specific template for the content.
* 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() );
?>
<?php endwhile;
/**
* @hooked storefront_paging_nav - 10
*/
do_action( 'storefront_loop_after' );

View file

@ -16,21 +16,7 @@ get_header(); ?>
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'storefront' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
</header><!-- .page-header -->
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/**
* Run the loop for the search to output the results.
* 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' );
?>
<?php endwhile; ?>
<?php storefront_paging_nav(); ?>
<?php get_template_part( 'loop' ); ?>
<?php else : ?>