mirror of
https://github.com/woocommerce/storefront.git
synced 2025-08-21 04:11:59 +08:00
pages and structure bits
This commit is contained in:
parent
e607c79af2
commit
d676d48836
6 changed files with 69 additions and 26 deletions
|
@ -7,17 +7,11 @@
|
|||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
<header class="entry-header">
|
||||
<?php the_title( '<h1 class="entry-title" itemprop="name">', '</h1>' ); ?>
|
||||
</header><!-- .entry-header -->
|
||||
|
||||
<div class="entry-content" itemprop="mainContentOfPage">
|
||||
<?php the_content(); ?>
|
||||
<?php
|
||||
wp_link_pages( array(
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'storefront' ),
|
||||
'after' => '</div>',
|
||||
) );
|
||||
?>
|
||||
</div><!-- .entry-content -->
|
||||
<?php
|
||||
/**
|
||||
* @hooked storefront_page_header - 10
|
||||
* @hooked storefront_page_content - 20
|
||||
*/
|
||||
do_action( 'storefront_page' );
|
||||
?>
|
||||
</article><!-- #post-## -->
|
||||
|
|
|
@ -27,6 +27,7 @@ require get_template_directory() . '/inc/structure/hooks.php';
|
|||
* Template functions used throughout the theme.
|
||||
*/
|
||||
require get_template_directory() . '/inc/structure/post.php';
|
||||
require get_template_directory() . '/inc/structure/page.php';
|
||||
require get_template_directory() . '/inc/structure/header.php';
|
||||
require get_template_directory() . '/inc/structure/footer.php';
|
||||
require get_template_directory() . '/inc/structure/comments.php';
|
||||
|
|
|
@ -38,14 +38,14 @@ add_action( 'storefront_footer', 'storefront_credit', 20 );
|
|||
|
||||
/**
|
||||
* Homepage
|
||||
* @see storefront_page_content()
|
||||
* @see storefront_homepage_content()
|
||||
* @see storefront_product_categories()
|
||||
* @see storefront_recent_products()
|
||||
* @see storefront_featured_products()
|
||||
* @see storefront_popular_products()
|
||||
* @see storefront_on_sale_products()
|
||||
*/
|
||||
add_action( 'homepage', 'storefront_page_content', 10 );
|
||||
add_action( 'homepage', 'storefront_homepage_content', 10 );
|
||||
add_action( 'homepage', 'storefront_product_categories', 20 );
|
||||
add_action( 'homepage', 'storefront_recent_products', 30 );
|
||||
add_action( 'homepage', 'storefront_featured_products', 40 );
|
||||
|
@ -60,14 +60,22 @@ add_action( 'homepage', 'storefront_on_sale_products', 60 );
|
|||
* @see storefront_paging_nav()
|
||||
* @see storefront_single_post_header()
|
||||
*/
|
||||
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_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', 'storefront_post_header', 10 );
|
||||
add_action( 'storefront_single_post', 'storefront_post_meta', 20 );
|
||||
add_action( 'storefront_single_post', 'storefront_post_content', 30 );
|
||||
|
||||
/**
|
||||
* Pages
|
||||
* @see storefront_page_header()
|
||||
* @see storefront_page_content()
|
||||
*/
|
||||
add_action( 'storefront_page', 'storefront_page_header', 10 );
|
||||
add_action( 'storefront_page', 'storefront_page_content', 20 );
|
||||
|
||||
/**
|
||||
* Extras
|
||||
|
|
40
inc/structure/page.php
Normal file
40
inc/structure/page.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* Template functions used for pages.
|
||||
*
|
||||
* @package storefront
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'storefront_page_header' ) ) {
|
||||
/**
|
||||
* Display the post header with a link to the single post
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function storefront_page_header() {
|
||||
?>
|
||||
<header class="entry-header">
|
||||
<?php the_title( '<h1 class="entry-title" itemprop="name">', '</h1>' ); ?>
|
||||
</header><!-- .entry-header -->
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'storefront_page_content' ) ) {
|
||||
/**
|
||||
* Display the post content with a link to the single post
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function storefront_page_content() {
|
||||
?>
|
||||
<div class="entry-content" itemprop="mainContentOfPage">
|
||||
<?php the_content(); ?>
|
||||
<?php
|
||||
wp_link_pages( array(
|
||||
'before' => '<div class="page-links">' . __( 'Pages:', 'storefront' ),
|
||||
'after' => '</div>',
|
||||
) );
|
||||
?>
|
||||
</div><!-- .entry-content -->
|
||||
<?php
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Template functions used for post posts.
|
||||
* Template functions used for posts.
|
||||
*
|
||||
* @package storefront
|
||||
*/
|
||||
|
|
|
@ -125,14 +125,14 @@ if ( ! function_exists( 'storefront_on_sale_products' ) ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'storefront_page_content' ) ) {
|
||||
if ( ! function_exists( 'storefront_homepage_content' ) ) {
|
||||
/**
|
||||
* Display page content
|
||||
* Display homepage content
|
||||
* Hooked into the `homepage` action in the homepage template
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
function storefront_page_content() {
|
||||
function storefront_homepage_content() {
|
||||
while ( have_posts() ) : the_post();
|
||||
|
||||
get_template_part( 'content', 'page' );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue