mirror of
https://github.com/woocommerce/storefront.git
synced 2025-08-21 04:11:59 +08:00
single post / page
This commit is contained in:
parent
d676d48836
commit
f12b72e965
4 changed files with 35 additions and 12 deletions
|
@ -5,6 +5,16 @@
|
|||
* @package storefront
|
||||
*/
|
||||
|
||||
/**
|
||||
* Storefront display comments
|
||||
*/
|
||||
function storefront_display_comments() {
|
||||
// If comments are open or we have at least one comment, load up the comment template
|
||||
if ( comments_open() || '0' != get_comments_number() ) :
|
||||
comments_template();
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Storefront comment template
|
||||
* @since 1.0.0
|
||||
|
|
|
@ -59,24 +59,33 @@ add_action( 'homepage', 'storefront_on_sale_products', 60 );
|
|||
* @see storefront_post_content()
|
||||
* @see storefront_paging_nav()
|
||||
* @see storefront_single_post_header()
|
||||
* @see storefront_post_nav()
|
||||
* @see storefront_display_comments()
|
||||
*/
|
||||
add_action( 'storefront_loop_post', 'storefront_post_header', 10 );
|
||||
add_action( 'storefront_loop_post', 'storefront_post_meta', 20 );
|
||||
add_action( 'storefront_loop_post', 'storefront_post_content', 30 );
|
||||
|
||||
add_action( 'storefront_loop_after', 'storefront_paging_nav', 10 );
|
||||
|
||||
add_action( 'storefront_single_post', 'storefront_post_header', 10 );
|
||||
add_action( 'storefront_single_post', 'storefront_post_meta', 20 );
|
||||
add_action( 'storefront_single_post', 'storefront_post_content', 30 );
|
||||
|
||||
add_action( 'storefront_single_post_after', 'storefront_post_nav', 10 );
|
||||
add_action( 'storefront_single_post_after', 'storefront_display_comments', 10 );
|
||||
|
||||
/**
|
||||
* Pages
|
||||
* @see storefront_page_header()
|
||||
* @see storefront_page_content()
|
||||
* @see storefront_display_comments()
|
||||
*/
|
||||
add_action( 'storefront_page', 'storefront_page_header', 10 );
|
||||
add_action( 'storefront_page', 'storefront_page_content', 20 );
|
||||
|
||||
add_action( 'storefront_page_after', 'storefront_display_comments', 10 );
|
||||
|
||||
/**
|
||||
* Extras
|
||||
* @see storefront_setup_author()
|
||||
|
|
12
page.php
12
page.php
|
@ -17,13 +17,17 @@ get_header(); ?>
|
|||
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
|
||||
<?php
|
||||
do_action( 'storefront_page_before' );
|
||||
?>
|
||||
|
||||
<?php get_template_part( 'content', 'page' ); ?>
|
||||
|
||||
<?php
|
||||
// If comments are open or we have at least one comment, load up the comment template
|
||||
if ( comments_open() || '0' != get_comments_number() ) :
|
||||
comments_template();
|
||||
endif;
|
||||
/**
|
||||
* @hooked storefront_display_comments - 10
|
||||
*/
|
||||
do_action( 'storefront_page_after' );
|
||||
?>
|
||||
|
||||
<?php endwhile; // end of the loop. ?>
|
||||
|
|
16
single.php
16
single.php
|
@ -12,15 +12,15 @@ get_header(); ?>
|
|||
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
|
||||
<?php get_template_part( 'content', 'single' ); ?>
|
||||
|
||||
<?php storefront_post_nav(); ?>
|
||||
|
||||
<?php
|
||||
// If comments are open or we have at least one comment, load up the comment template
|
||||
if ( comments_open() || '0' != get_comments_number() ) :
|
||||
comments_template();
|
||||
endif;
|
||||
do_action( 'storefront_single_post_before' );
|
||||
|
||||
get_template_part( 'content', 'single' );
|
||||
|
||||
/**
|
||||
* @hooked storefront_post_nav - 10
|
||||
*/
|
||||
do_action( 'storefront_single_post_after' );
|
||||
?>
|
||||
|
||||
<?php endwhile; // end of the loop. ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue