diff --git a/content-single.php b/content-single.php
index 5b02176f..70860506 100755
--- a/content-single.php
+++ b/content-single.php
@@ -5,51 +5,14 @@
?>
itemscope="" itemtype="http://schema.org/BlogPosting">
-
-
-
-
- 'image' ) );
- }
- ?>
-
- '
' . __( 'Pages:', 'storefront' ),
- 'after' => '
',
- ) );
- ?>
-
diff --git a/content.php b/content.php
index c59d8471..7ba4ccfb 100755
--- a/content.php
+++ b/content.php
@@ -5,53 +5,14 @@
?>
itemscope="" itemtype="http://schema.org/BlogPosting">
-
-
-
-
- 'image' ) );
- }
- ?>
- →', 'storefront' ) ); ?>
- '
' . __( 'Pages:', 'storefront' ),
- 'after' => '
',
- ) );
- ?>
-
\ No newline at end of file
diff --git a/inc/functions/extras.php b/inc/functions/extras.php
index 9a9381e8..2c4b3231 100755
--- a/inc/functions/extras.php
+++ b/inc/functions/extras.php
@@ -118,3 +118,44 @@ function storefront_html_tag_schema() {
echo 'itemscope="itemscope" itemtype="' . $schema . $type . '"';
}
+
+/**
+ * Returns true if a blog has more than 1 category.
+ *
+ * @return bool
+ */
+function storefront_categorized_blog() {
+ if ( false === ( $all_the_cool_cats = get_transient( 'storefront_categories' ) ) ) {
+ // Create an array of all the categories that are attached to posts.
+ $all_the_cool_cats = get_categories( array(
+ 'fields' => 'ids',
+ 'hide_empty' => 1,
+
+ // We only need to know if there is more than one category.
+ 'number' => 2,
+ ) );
+
+ // Count the number of categories that are attached to the posts.
+ $all_the_cool_cats = count( $all_the_cool_cats );
+
+ set_transient( 'storefront_categories', $all_the_cool_cats );
+ }
+
+ if ( $all_the_cool_cats > 1 ) {
+ // This blog has more than 1 category so storefront_categorized_blog should return true.
+ return true;
+ } else {
+ // This blog has only 1 category so storefront_categorized_blog should return false.
+ return false;
+ }
+}
+
+/**
+ * Flush out the transients used in storefront_categorized_blog.
+ */
+function storefront_category_transient_flusher() {
+ // Like, beat it. Dig?
+ delete_transient( 'storefront_categories' );
+}
+add_action( 'edit_category', 'storefront_category_transient_flusher' );
+add_action( 'save_post', 'storefront_category_transient_flusher' );
diff --git a/inc/init.php b/inc/init.php
index 16d7bd0d..2b34493c 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -23,8 +23,13 @@ require get_template_directory() . '/inc/functions/setup.php';
require get_template_directory() . '/inc/structure/hooks.php';
/**
- * Custom template tags for this theme.
+ * Structure.
+ * Template functions used throughout the theme.
*/
+require get_template_directory() . '/inc/structure/post.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';
require get_template_directory() . '/inc/structure/template-tags.php';
/**
@@ -50,7 +55,7 @@ require get_template_directory() . '/inc/jetpack/jetpack.php';
require get_template_directory() . '/inc/admin/welcome-screen.php';
/**
- * Load Jetpack WooCommerce file.
+ * Load WooCommerce compatibility files.
*/
if ( is_woocommerce_activated() ) {
require get_template_directory() . '/inc/woocommerce/hooks.php';
diff --git a/inc/structure/comments.php b/inc/structure/comments.php
new file mode 100644
index 00000000..a6a8e963
--- /dev/null
+++ b/inc/structure/comments.php
@@ -0,0 +1,55 @@
+
+ < id="comment-">
+
+
+
+
+
+
+
+ 0 ) : ?>
+
+
+
+
+
+
+
|
+ woothemes' ); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'image' ) );
+ }
+ ?>
+ →', 'storefront' ) ); ?>
+ '
' . __( 'Pages:', 'storefront' ),
+ 'after' => '
',
+ ) );
+ ?>
+
+
+
+ max_num_pages < 2 ) {
+ return;
+ }
+ ?>
+
+ post_parent ) : get_adjacent_post( false, '', true );
+ $next = get_adjacent_post( false, '', false );
+
+ if ( ! $next && ! $previous ) {
+ return;
+ }
+ ?>
+
+ %2$s';
+ if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
+ $time_string = '';
+ }
+
+ $time_string = sprintf( $time_string,
+ esc_attr( get_the_date( 'c' ) ),
+ esc_html( get_the_date() ),
+ esc_attr( get_the_modified_date( 'c' ) ),
+ esc_html( get_the_modified_date() )
+ );
+
+ $posted_on = sprintf(
+ _x( 'Posted on %s', 'post date', 'storefront' ),
+ '' . $time_string . ''
+ );
+
+ $byline = sprintf(
+ _x( 'by %s', 'post author', 'storefront' ),
+ '' . esc_html( get_the_author() ) . ''
+ );
+
+ echo '' . $posted_on . ' ' . $byline . '';
+
+ }
+}
\ No newline at end of file
diff --git a/inc/structure/template-tags.php b/inc/structure/template-tags.php
index ef612402..f5536d7e 100755
--- a/inc/structure/template-tags.php
+++ b/inc/structure/template-tags.php
@@ -7,402 +7,136 @@
* @package storefront
*/
-if ( ! function_exists( 'storefront_paging_nav' ) ) :
-/**
- * Display navigation to next/previous set of posts when applicable.
- */
-function storefront_paging_nav() {
- // Don't print empty markup if there's only one page.
- if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
- return;
- }
- ?>
-
- ' . $defaults['title'] . '';
+ echo do_shortcode( '[product_categories number="' . $defaults['limit'] . '" columns="' . $defaults['columns'] . '" orderby="' . $defaults['orderby'] . '" parent="' . $defaults['child_categories'] . '"]' );
-if ( ! function_exists( 'storefront_post_nav' ) ) :
-/**
- * Display navigation to next/previous post when applicable.
- */
-function storefront_post_nav() {
- // Don't print empty markup if there's nowhere to navigate.
- $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
- $next = get_adjacent_post( false, '', false );
-
- if ( ! $next && ! $previous ) {
- return;
- }
- ?>
-
- %2$s';
- if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
- $time_string = '';
- }
-
- $time_string = sprintf( $time_string,
- esc_attr( get_the_date( 'c' ) ),
- esc_html( get_the_date() ),
- esc_attr( get_the_modified_date( 'c' ) ),
- esc_html( get_the_modified_date() )
- );
-
- $posted_on = sprintf(
- _x( 'Posted on %s', 'post date', 'storefront' ),
- '' . $time_string . ''
- );
-
- $byline = sprintf(
- _x( 'by %s', 'post author', 'storefront' ),
- '' . esc_html( get_the_author() ) . ''
- );
-
- echo '' . $posted_on . ' ' . $byline . '';
-
-}
-endif;
-
-/**
- * Returns true if a blog has more than 1 category.
- *
- * @return bool
- */
-function storefront_categorized_blog() {
- if ( false === ( $all_the_cool_cats = get_transient( 'storefront_categories' ) ) ) {
- // Create an array of all the categories that are attached to posts.
- $all_the_cool_cats = get_categories( array(
- 'fields' => 'ids',
- 'hide_empty' => 1,
-
- // We only need to know if there is more than one category.
- 'number' => 2,
- ) );
-
- // Count the number of categories that are attached to the posts.
- $all_the_cool_cats = count( $all_the_cool_cats );
-
- set_transient( 'storefront_categories', $all_the_cool_cats );
- }
-
- if ( $all_the_cool_cats > 1 ) {
- // This blog has more than 1 category so storefront_categorized_blog should return true.
- return true;
- } else {
- // This blog has only 1 category so storefront_categorized_blog should return false.
- return false;
+ echo '';
}
}
-/**
- * Flush out the transients used in storefront_categorized_blog.
- */
-function storefront_category_transient_flusher() {
- // Like, beat it. Dig?
- delete_transient( 'storefront_categories' );
-}
-add_action( 'edit_category', 'storefront_category_transient_flusher' );
-add_action( 'save_post', 'storefront_category_transient_flusher' );
+if ( ! function_exists( 'storefront_recent_products' ) ) {
+ /**
+ * Display Recent Products
+ * Hooked into the `homepage` action in the homepage template
+ * @since 1.0.0
+ * @return void
+ */
+ function storefront_recent_products( $defaults ) {
+ $defaults = apply_filters( 'storefront_recent_products_args', array(
+ 'limit' => 4,
+ 'columns' => 4,
+ 'title' => __( 'Recent Products', 'storefront' ),
+ ) );
-/**
- * Display header widget region
- * @since 1.0.0
- */
-function storefront_header_widget_region() {
- ?>
-
- ';
-/**
- * Display Site Branding
- * @since 1.0.0
- * @return void
- */
-function storefront_site_branding() {
- if ( function_exists( 'has_site_logo' ) && has_site_logo() ) {
- the_site_logo();
- } else {
- ?>
-
- ' . $defaults['title'] . '';
+ echo do_shortcode( '[recent_products per_page="' . $defaults['limit'] . '" columns="' . $defaults['columns'] . '"]' );
-/**
- * Display Primary Navigation
- * @since 1.0.0
- * @return void
- */
-function storefront_primary_navigation() {
- ?>
-
-
-
- 3,
- 'columns' => 3,
- 'child_categories' => 0,
- 'orderby' => 'name',
- 'title' => __( 'Product Categories', 'storefront' ),
- ) );
-
- echo '';
-
- echo '' . $defaults['title'] . '
';
- echo do_shortcode( '[product_categories number="' . $defaults['limit'] . '" columns="' . $defaults['columns'] . '" orderby="' . $defaults['orderby'] . '" parent="' . $defaults['child_categories'] . '"]' );
-
- echo '';
-}
-
-/**
- * Display Recent Products
- * @since 1.0.0
- * @return void
- */
-function storefront_recent_products( $defaults ) {
- $defaults = apply_filters( 'storefront_recent_products_args', array(
- 'limit' => 4,
- 'columns' => 4,
- 'title' => __( 'Recent Products', 'storefront' ),
- ) );
-
- echo '';
-
- echo '' . $defaults['title'] . '
';
- echo do_shortcode( '[recent_products per_page="' . $defaults['limit'] . '" columns="' . $defaults['columns'] . '"]' );
-
- echo '';
-}
-
-/**
- * Display Featured Products
- * @since 1.0.0
- * @return void
- */
-function storefront_featured_products( $defaults ) {
- $defaults = apply_filters( 'storefront_featured_products_args', array(
- 'limit' => 4,
- 'columns' => 4,
- 'title' => __( 'Featured Products', 'storefront' ),
- ) );
-
- echo '';
-
- echo '' . $defaults['title'] . '
';
- echo do_shortcode( '[featured_products per_page="' . $defaults['limit'] . '" columns="' . $defaults['columns'] . '"]' );
-
- echo '';
-}
-
-/**
- * Display Popular Products
- * @since 1.0.0
- * @return void
- */
-function storefront_popular_products( $defaults ) {
- $defaults = apply_filters( 'storefront_popular_products_args', array(
- 'limit' => 4,
- 'columns' => 4,
- 'title' => __( 'Top Rated Products', 'storefront' ),
- ) );
-
- echo '';
-
- echo '' . $defaults['title'] . '
';
- echo do_shortcode( '[top_rated_products per_page="' . $defaults['limit'] . '" columns="' . $defaults['columns'] . '"]' );
-
- echo '';
-}
-
-/**
- * Display On Sale Products
- * @since 1.0.0
- * @return void
- */
-function storefront_on_sale_products( $defaults ) {
- $defaults = apply_filters( 'storefront_on_sale_products_args', array(
- 'limit' => 4,
- 'columns' => 4,
- 'title' => __( 'On Sale', 'storefront' ),
- ) );
-
- echo '';
-
- echo '' . $defaults['title'] . '
';
- echo do_shortcode( '[sale_products per_page="' . $defaults['limit'] . '" columns="' . $defaults['columns'] . '"]' );
-
- echo '';
-}
-
-/**
- * Display page content
- * @since 1.0.0
- * @return void
- */
-function storefront_page_content() {
- while ( have_posts() ) : the_post();
-
- get_template_part( 'content', 'page' );
-
- endwhile; // end of the loop.
-}
-
-/**
- * Display the footer widget regions
- * @since 1.0.0
- * @return void
- */
-function storefront_footer_widgets() {
- if ( is_active_sidebar( 'footer-4' ) ) {
- $widget_columns = apply_filters( 'storefront_footer_widget_regions', 4 );
- } elseif ( is_active_sidebar( 'footer-3' ) ) {
- $widget_columns = apply_filters( 'storefront_footer_widget_regions', 3 );
- } elseif ( is_active_sidebar( 'footer-2' ) ) {
- $widget_columns = apply_filters( 'storefront_footer_widget_regions', 2 );
- } elseif ( is_active_sidebar( 'footer-1' ) ) {
- $widget_columns = apply_filters( 'storefront_footer_widget_regions', 1 );
- } else {
- $widget_columns = apply_filters( 'storefront_footer_widget_regions', 0 );
+ echo '';
}
-
- if ( $widget_columns > 0 ) : ?>
-
-
-
-
-
-
-
|
- woothemes' ); ?>
-
- 4,
+ 'columns' => 4,
+ 'title' => __( 'Featured Products', 'storefront' ),
+ ) );
-function storefront_comment( $comment, $args, $depth ) {
- $GLOBALS['comment'] = $comment;
- extract( $args, EXTR_SKIP );
+ echo '';
- if ( 'div' == $args['style'] ) {
- $tag = 'div';
- $add_below = 'comment';
- } else {
- $tag = 'li';
- $add_below = 'div-comment';
+ echo '' . $defaults['title'] . '
';
+ echo do_shortcode( '[featured_products per_page="' . $defaults['limit'] . '" columns="' . $defaults['columns'] . '"]' );
+
+ echo '';
}
-?>
- < id="comment-">
-
-
-
-
-
-
-
-' . $defaults['title'] . '';
+ echo do_shortcode( '[top_rated_products per_page="' . $defaults['limit'] . '" columns="' . $defaults['columns'] . '"]' );
+
+ echo '';
+ }
+}
+
+if ( ! function_exists( 'storefront_on_sale_products' ) ) {
+ /**
+ * Display On Sale Products
+ * Hooked into the `homepage` action in the homepage template
+ * @since 1.0.0
+ * @return void
+ */
+ function storefront_on_sale_products( $defaults ) {
+ $defaults = apply_filters( 'storefront_on_sale_products_args', array(
+ 'limit' => 4,
+ 'columns' => 4,
+ 'title' => __( 'On Sale', 'storefront' ),
+ ) );
+
+ echo '';
+
+ echo '' . $defaults['title'] . '
';
+ echo do_shortcode( '[sale_products per_page="' . $defaults['limit'] . '" columns="' . $defaults['columns'] . '"]' );
+
+ echo '';
+ }
+}
+
+if ( ! function_exists( 'storefront_page_content' ) ) {
+ /**
+ * Display page content
+ * Hooked into the `homepage` action in the homepage template
+ * @since 1.0.0
+ * @return void
+ */
+ function storefront_page_content() {
+ while ( have_posts() ) : the_post();
+
+ get_template_part( 'content', 'page' );
+
+ endwhile; // end of the loop.
+ }
}
\ No newline at end of file
+ + + + ' . get_comment_date() . ''; ?> + +