2016-01-20 16:02:53 +00:00
< ? php
/**
* Storefront template functions .
*
* @ package storefront
*/
if ( ! function_exists ( 'storefront_display_comments' ) ) {
/**
* Storefront display comments
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
*/
function storefront_display_comments () {
2016-02-19 16:57:56 +00:00
// If comments are open or we have at least one comment, load up the comment template.
2018-11-23 14:56:29 +00:00
if ( comments_open () || 0 !== intval ( get_comments_number () ) ) :
2016-01-20 16:02:53 +00:00
comments_template ();
endif ;
}
}
if ( ! function_exists ( 'storefront_comment' ) ) {
/**
* Storefront comment template
2016-02-19 16:57:56 +00:00
*
* @ param array $comment the comment array .
2016-02-25 14:46:06 +00:00
* @ param array $args the comment args .
* @ param int $depth the comment depth .
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
*/
function storefront_comment ( $comment , $args , $depth ) {
2018-11-21 17:32:12 +00:00
if ( 'div' === $args [ 'style' ] ) {
2018-11-21 11:52:42 +00:00
$tag = 'div' ;
2016-01-20 16:02:53 +00:00
$add_below = 'comment' ;
} else {
2018-11-21 11:52:42 +00:00
$tag = 'li' ;
2016-01-20 16:02:53 +00:00
$add_below = 'div-comment' ;
}
?>
2018-06-22 15:11:39 +01:00
<< ? php echo esc_attr ( $tag ); ?> <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?> id="comment-<?php comment_ID(); ?>">
2016-01-20 16:02:53 +00:00
< div class = " comment-body " >
< div class = " comment-meta commentmetadata " >
< div class = " comment-author vcard " >
< ? php echo get_avatar ( $comment , 128 ); ?>
2016-03-15 13:18:22 +00:00
< ? php printf ( wp_kses_post ( '<cite class="fn">%s</cite>' , 'storefront' ), get_comment_author_link () ); ?>
2016-01-20 16:02:53 +00:00
</ div >
2018-11-21 17:32:12 +00:00
< ? php if ( '0' === $comment -> comment_approved ) : ?>
2020-11-13 09:38:17 +01:00
< em class = " comment-awaiting-moderation " >< ? php esc_html_e ( 'Your comment is awaiting moderation.' , 'storefront' ); ?> </em>
2016-01-20 16:02:53 +00:00
< br />
< ? php endif ; ?>
< a href = " <?php echo esc_url( htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ); ?> " class = " comment-date " >
2021-01-11 10:28:43 -05:00
< ? php echo '<time datetime="' . esc_attr ( get_comment_date ( 'c' ) ) . '">' . esc_html ( get_comment_date () ) . '</time>' ; ?>
2016-01-20 16:02:53 +00:00
</ a >
</ div >
2018-11-21 17:32:12 +00:00
< ? php if ( 'div' !== $args [ 'style' ] ) : ?>
2018-06-22 15:11:39 +01:00
< div id = " div-comment-<?php comment_ID(); ?> " class = " comment-content " >
2016-01-20 16:02:53 +00:00
< ? php endif ; ?>
2016-04-25 13:49:21 +01:00
< div class = " comment-text " >
2016-01-20 16:02:53 +00:00
< ? php comment_text (); ?>
2016-04-25 13:49:21 +01:00
</ div >
2016-01-20 16:02:53 +00:00
< div class = " reply " >
2018-06-22 15:11:39 +01:00
< ? php
comment_reply_link (
array_merge (
2020-09-17 11:28:22 +12:00
$args ,
array (
2018-06-22 15:11:39 +01:00
'add_below' => $add_below ,
2018-11-21 11:52:42 +00:00
'depth' => $depth ,
2018-06-22 15:11:39 +01:00
'max_depth' => $args [ 'max_depth' ],
)
)
);
?>
2016-01-20 16:02:53 +00:00
< ? php edit_comment_link ( __ ( 'Edit' , 'storefront' ), ' ' , '' ); ?>
</ div >
</ div >
2018-11-21 17:32:12 +00:00
< ? php if ( 'div' !== $args [ 'style' ] ) : ?>
2016-01-20 16:02:53 +00:00
</ div >
< ? php endif ; ?>
2018-06-22 15:11:39 +01:00
< ? php
2016-01-20 16:02:53 +00:00
}
}
if ( ! function_exists ( 'storefront_footer_widgets' ) ) {
/**
2016-10-15 02:31:51 +02:00
* Display the footer widget regions .
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
2016-10-08 02:23:22 +02:00
* @ return void
2016-01-20 16:02:53 +00:00
*/
function storefront_footer_widgets () {
2017-01-19 14:41:42 +00:00
$rows = intval ( apply_filters ( 'storefront_footer_widget_rows' , 1 ) );
$regions = intval ( apply_filters ( 'storefront_footer_widget_columns' , 4 ) );
2016-01-20 16:02:53 +00:00
2016-10-15 02:31:51 +02:00
for ( $row = 1 ; $row <= $rows ; $row ++ ) :
2016-01-20 16:02:53 +00:00
2016-10-15 02:31:51 +02:00
// Defines the number of active columns in this footer row.
2016-10-14 16:05:25 +02:00
for ( $region = $regions ; 0 < $region ; $region -- ) {
2018-06-22 15:11:39 +01:00
if ( is_active_sidebar ( 'footer-' . esc_attr ( $region + $regions * ( $row - 1 ) ) ) ) {
2016-10-14 21:30:29 +02:00
$columns = $region ;
2016-10-12 23:25:51 +02:00
break ;
}
}
2016-01-20 16:02:53 +00:00
2018-06-22 15:11:39 +01:00
if ( isset ( $columns ) ) :
?>
< div class =< ? php echo '"footer-widgets row-' . esc_attr ( $row ) . ' col-' . esc_attr ( $columns ) . ' fix"' ; ?> >
2018-11-21 17:32:12 +00:00
< ? php
for ( $column = 1 ; $column <= $columns ; $column ++ ) :
$footer_n = $column + $regions * ( $row - 1 );
2016-01-20 16:02:53 +00:00
2018-11-21 17:32:12 +00:00
if ( is_active_sidebar ( 'footer-' . esc_attr ( $footer_n ) ) ) :
?>
< div class = " block footer-widget-<?php echo esc_attr( $column ); ?> " >
< ? php dynamic_sidebar ( 'footer-' . esc_attr ( $footer_n ) ); ?>
</ div >
< ? php
endif ;
endfor ;
?>
</ div ><!-- . footer - widgets . row -< ? php echo esc_attr ( $row ); ?> -->
< ? php
unset ( $columns );
2016-10-15 02:31:51 +02:00
endif ;
endfor ;
2016-01-20 16:02:53 +00:00
}
}
if ( ! function_exists ( 'storefront_credit' ) ) {
/**
* Display the theme credit
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
* @ return void
*/
function storefront_credit () {
2019-07-04 12:21:50 +01:00
$links_output = '' ;
if ( apply_filters ( 'storefront_credit_link' , true ) ) {
2020-01-04 15:43:00 +08:00
if ( storefront_is_woocommerce_activated () ) {
2024-04-10 16:26:33 -04:00
$links_output .= '<a href="https://woocommerce.com" target="_blank" title="' . esc_attr__ ( 'WooCommerce - The Best eCommerce Platform for WordPress' , 'storefront' ) . '" rel="noreferrer nofollow">' . esc_html__ ( 'Built with WooCommerce' , 'storefront' ) . '</a>.' ;
2020-01-04 15:43:00 +08:00
} else {
2024-04-10 16:26:33 -04:00
$links_output .= '<a href="https://woocommerce.com/products/storefront/" target="_blank" title="' . esc_attr__ ( 'Storefront - The perfect platform for your next WooCommerce project.' , 'storefront' ) . '" rel="noreferrer nofollow">' . esc_html__ ( 'Built with Storefront' , 'storefront' ) . '</a>.' ;
2020-01-04 15:43:00 +08:00
}
2019-07-04 12:21:50 +01:00
}
if ( apply_filters ( 'storefront_privacy_policy_link' , true ) && function_exists ( 'the_privacy_policy_link' ) ) {
2020-09-17 11:28:22 +12:00
$separator = '<span role="separator" aria-hidden="true"></span>' ;
2019-07-04 12:21:50 +01:00
$links_output = get_the_privacy_policy_link ( '' , ( ! empty ( $links_output ) ? $separator : '' ) ) . $links_output ;
}
2020-09-17 11:28:22 +12:00
2019-08-09 17:27:06 -06:00
$links_output = apply_filters ( 'storefront_credit_links_output' , $links_output );
2016-01-20 16:02:53 +00:00
?>
< div class = " site-info " >
2020-09-17 11:28:22 +12:00
< ? php echo esc_html ( apply_filters ( 'storefront_copyright_text' , $content = '© ' . get_bloginfo ( 'name' ) . ' ' . gmdate ( 'Y' ) ) ); ?>
2019-07-04 12:21:50 +01:00
< ? php if ( ! empty ( $links_output ) ) { ?>
< br />
< ? php echo wp_kses_post ( $links_output ); ?>
2016-01-20 16:02:53 +00:00
< ? php } ?>
</ div ><!-- . site - info -->
< ? php
}
}
if ( ! function_exists ( 'storefront_header_widget_region' ) ) {
/**
* Display header widget region
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
*/
function storefront_header_widget_region () {
if ( is_active_sidebar ( 'header-1' ) ) {
2018-06-22 15:11:39 +01:00
?>
2016-01-20 16:02:53 +00:00
< div class = " header-widget-region " role = " complementary " >
< div class = " col-full " >
< ? php dynamic_sidebar ( 'header-1' ); ?>
</ div >
</ div >
2018-06-22 15:11:39 +01:00
< ? php
2016-01-20 16:02:53 +00:00
}
}
}
if ( ! function_exists ( 'storefront_site_branding' ) ) {
/**
2016-08-03 09:49:16 +01:00
* Site branding wrapper and display
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
* @ return void
*/
2016-08-01 11:17:10 +01:00
function storefront_site_branding () {
?>
< div class = " site-branding " >
2016-08-03 09:49:16 +01:00
< ? php storefront_site_title_or_logo (); ?>
2016-08-01 11:17:10 +01:00
</ div >
< ? php
2016-01-20 16:02:53 +00:00
}
}
2016-08-03 09:49:16 +01:00
if ( ! function_exists ( 'storefront_site_title_or_logo' ) ) {
/**
* Display the site title or logo
*
2016-10-08 02:20:48 -03:00
* @ since 2.1 . 0
* @ param bool $echo Echo the string or return it .
* @ return string
2016-08-03 09:49:16 +01:00
*/
2016-10-08 02:20:48 -03:00
function storefront_site_title_or_logo ( $echo = true ) {
2016-08-03 09:49:16 +01:00
if ( function_exists ( 'the_custom_logo' ) && has_custom_logo () ) {
$logo = get_custom_logo ();
2018-05-23 15:40:55 +03:00
$html = is_home () ? '<h1 class="logo">' . $logo . '</h1>' : $logo ;
2016-08-03 09:49:16 +01:00
} else {
2018-05-23 15:40:55 +03:00
$tag = is_home () ? 'h1' : 'div' ;
2016-08-03 09:49:16 +01:00
2018-06-22 15:11:39 +01:00
$html = '<' . esc_attr ( $tag ) . ' class="beta site-title"><a href="' . esc_url ( home_url ( '/' ) ) . '" rel="home">' . esc_html ( get_bloginfo ( 'name' ) ) . '</a></' . esc_attr ( $tag ) . '>' ;
2016-08-03 09:49:16 +01:00
2016-10-08 02:20:48 -03:00
if ( '' !== get_bloginfo ( 'description' ) ) {
$html .= '<p class="site-description">' . esc_html ( get_bloginfo ( 'description' , 'display' ) ) . '</p>' ;
2016-08-03 09:49:16 +01:00
}
}
2016-10-08 02:20:48 -03:00
if ( ! $echo ) {
return $html ;
}
2020-09-17 11:28:22 +12:00
echo $html ; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2016-08-03 09:49:16 +01:00
}
}
2016-01-20 16:02:53 +00:00
if ( ! function_exists ( 'storefront_primary_navigation' ) ) {
/**
* Display Primary Navigation
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
* @ return void
*/
function storefront_primary_navigation () {
?>
2020-11-13 09:38:17 +01:00
< nav id = " site-navigation " class = " main-navigation " role = " navigation " aria - label = " <?php esc_attr_e( 'Primary Navigation', 'storefront' ); ?> " >
2022-06-28 04:03:17 -07:00
< button id = " site-navigation-menu-toggle " class = " menu-toggle " aria - controls = " site-navigation " aria - expanded = " false " >< span >< ? php echo esc_html ( apply_filters ( 'storefront_menu_toggle_text' , __ ( 'Menu' , 'storefront' ) ) ); ?> </span></button>
2016-01-20 16:02:53 +00:00
< ? php
2019-03-15 18:23:38 +00:00
wp_nav_menu (
array (
'theme_location' => 'primary' ,
'container_class' => 'primary-navigation' ,
)
);
wp_nav_menu (
array (
'theme_location' => 'handheld' ,
'container_class' => 'handheld-navigation' ,
)
);
2016-01-20 16:02:53 +00:00
?>
2016-07-27 15:50:32 +02:00
</ nav ><!-- #site-navigation -->
2016-01-20 16:02:53 +00:00
< ? php
}
}
if ( ! function_exists ( 'storefront_secondary_navigation' ) ) {
/**
* Display Secondary Navigation
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
* @ return void
*/
function storefront_secondary_navigation () {
2018-06-22 15:11:39 +01:00
if ( has_nav_menu ( 'secondary' ) ) {
?>
2021-01-14 10:35:31 +01:00
< nav class = " secondary-navigation " role = " navigation " aria - label = " <?php esc_attr_e( 'Secondary Navigation', 'storefront' ); ?> " >
2018-06-22 15:11:39 +01:00
< ? php
wp_nav_menu (
array (
2018-11-21 11:52:42 +00:00
'theme_location' => 'secondary' ,
'fallback_cb' => '' ,
2018-06-22 15:11:39 +01:00
)
);
?>
</ nav ><!-- #site-navigation -->
< ? php
2016-06-23 05:46:21 -06:00
}
2016-01-20 16:02:53 +00:00
}
}
if ( ! function_exists ( 'storefront_skip_links' ) ) {
/**
* Skip links
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.4 . 1
* @ return void
*/
function storefront_skip_links () {
?>
2020-11-13 09:38:17 +01:00
< a class = " skip-link screen-reader-text " href = " #site-navigation " >< ? php esc_html_e ( 'Skip to navigation' , 'storefront' ); ?> </a>
< a class = " skip-link screen-reader-text " href = " #content " >< ? php esc_html_e ( 'Skip to content' , 'storefront' ); ?> </a>
2016-01-20 16:02:53 +00:00
< ? php
}
}
2017-01-23 17:54:58 +00:00
if ( ! function_exists ( 'storefront_homepage_header' ) ) {
/**
* Display the page header without the featured image
*
* @ since 1.0 . 0
*/
function storefront_homepage_header () {
2017-02-08 15:38:40 +00:00
edit_post_link ( __ ( 'Edit this section' , 'storefront' ), '' , '' , '' , 'button storefront-hero__button-edit' );
2017-01-23 17:54:58 +00:00
?>
< header class = " entry-header " >
< ? php
the_title ( '<h1 class="entry-title">' , '</h1>' );
?>
</ header ><!-- . entry - header -->
< ? php
}
}
2016-01-20 16:02:53 +00:00
if ( ! function_exists ( 'storefront_page_header' ) ) {
/**
2017-01-23 17:54:58 +00:00
* Display the page header
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
*/
function storefront_page_header () {
2019-04-10 11:11:24 +01:00
if ( is_front_page () && is_page_template ( 'template-fullwidth.php' ) ) {
return ;
}
2016-01-20 16:02:53 +00:00
?>
< header class = " entry-header " >
< ? php
storefront_post_thumbnail ( 'full' );
2016-05-26 07:57:50 +02:00
the_title ( '<h1 class="entry-title">' , '</h1>' );
2016-01-20 16:02:53 +00:00
?>
</ header ><!-- . entry - header -->
< ? php
}
}
if ( ! function_exists ( 'storefront_page_content' ) ) {
/**
2017-01-23 17:54:58 +00:00
* Display the post content
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
*/
function storefront_page_content () {
?>
2016-05-26 07:57:50 +02:00
< div class = " entry-content " >
2016-01-20 16:02:53 +00:00
< ? php the_content (); ?>
< ? php
2018-06-22 15:11:39 +01:00
wp_link_pages (
array (
'before' => '<div class="page-links">' . __ ( 'Pages:' , 'storefront' ),
'after' => '</div>' ,
)
);
2016-01-20 16:02:53 +00:00
?>
</ div ><!-- . entry - content -->
< ? php
}
}
if ( ! function_exists ( 'storefront_post_header' ) ) {
/**
* Display the post header with a link to the single post
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
*/
2016-02-25 14:46:06 +00:00
function storefront_post_header () {
?>
2016-01-20 16:02:53 +00:00
< header class = " entry-header " >
< ? php
2019-01-25 18:15:49 +00:00
/**
* Functions hooked in to storefront_post_header_before action .
*
* @ hooked storefront_post_meta - 10
*/
do_action ( 'storefront_post_header_before' );
2016-01-20 16:02:53 +00:00
if ( is_single () ) {
2016-05-26 07:57:50 +02:00
the_title ( '<h1 class="entry-title">' , '</h1>' );
2016-01-20 16:02:53 +00:00
} else {
2016-07-28 14:27:12 +02:00
the_title ( sprintf ( '<h2 class="alpha entry-title"><a href="%s" rel="bookmark">' , esc_url ( get_permalink () ) ), '</a></h2>' );
2016-01-20 16:02:53 +00:00
}
2019-01-25 18:15:49 +00:00
do_action ( 'storefront_post_header_after' );
2016-01-20 16:02:53 +00:00
?>
</ header ><!-- . entry - header -->
< ? php
}
}
if ( ! function_exists ( 'storefront_post_content' ) ) {
/**
* Display the post content with a link to the single post
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
*/
function storefront_post_content () {
?>
2016-05-26 07:57:50 +02:00
< div class = " entry-content " >
2016-01-20 16:02:53 +00:00
< ? php
2016-10-03 11:13:18 +01:00
/**
* Functions hooked in to storefront_post_content_before action .
*
* @ hooked storefront_post_thumbnail - 10
*/
do_action ( 'storefront_post_content_before' );
2016-01-20 16:02:53 +00:00
the_content (
sprintf (
2018-06-22 15:11:39 +01:00
/* translators: %s: post title */
2016-01-20 16:02:53 +00:00
__ ( 'Continue reading %s' , 'storefront' ),
'<span class="screen-reader-text">' . get_the_title () . '</span>'
)
);
2016-10-03 11:13:18 +01:00
do_action ( 'storefront_post_content_after' );
2018-06-22 15:11:39 +01:00
wp_link_pages (
array (
'before' => '<div class="page-links">' . __ ( 'Pages:' , 'storefront' ),
'after' => '</div>' ,
)
);
2016-01-20 16:02:53 +00:00
?>
</ div ><!-- . entry - content -->
< ? php
}
}
if ( ! function_exists ( 'storefront_post_meta' ) ) {
/**
* Display the post meta
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
*/
function storefront_post_meta () {
2019-01-25 18:15:49 +00:00
if ( 'post' !== get_post_type () ) {
return ;
}
2018-11-22 15:13:45 +00:00
// Posted on.
2018-10-31 15:29:14 +00:00
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>' ;
if ( get_the_time ( 'U' ) !== get_the_modified_time ( 'U' ) ) {
2019-01-25 17:46:19 +00:00
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>' ;
2018-10-31 15:29:14 +00:00
}
$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 () )
);
2019-01-07 16:03:45 +00:00
$output_time_string = sprintf ( '<a href="%1$s" rel="bookmark">%2$s</a>' , esc_url ( get_permalink () ), $time_string );
$posted_on = '
< span class = " posted-on " > ' .
2018-10-31 15:29:14 +00:00
/* translators: %s: post date */
2019-01-07 16:03:45 +00:00
sprintf ( __ ( 'Posted on %s' , 'storefront' ), $output_time_string ) .
'</span>' ;
2018-10-31 15:29:14 +00:00
2018-11-22 15:13:45 +00:00
// Author.
2018-10-31 15:29:14 +00:00
$author = sprintf (
'<span class="post-author">%1$s <a href="%2$s" class="url fn" rel="author">%3$s</a></span>' ,
__ ( 'by' , 'storefront' ),
esc_url ( get_author_posts_url ( get_the_author_meta ( 'ID' ) ) ),
esc_html ( get_the_author () )
);
2018-11-22 15:13:45 +00:00
// Comments.
2018-10-31 15:29:14 +00:00
$comments = '' ;
2018-11-23 14:56:29 +00:00
if ( ! post_password_required () && ( comments_open () || 0 !== intval ( get_comments_number () ) ) ) {
2018-10-31 15:29:14 +00:00
$comments_number = get_comments_number_text ( __ ( 'Leave a comment' , 'storefront' ), __ ( '1 Comment' , 'storefront' ), __ ( '% Comments' , 'storefront' ) );
$comments = sprintf (
'<span class="post-comments">— <a href="%1$s">%2$s</a></span>' ,
esc_url ( get_comments_link () ),
$comments_number
);
}
echo wp_kses (
2020-09-17 11:28:22 +12:00
sprintf ( '%1$s %2$s %3$s' , $posted_on , $author , $comments ),
array (
2018-10-31 15:29:14 +00:00
'span' => array (
2018-11-23 16:24:07 +00:00
'class' => array (),
2018-10-31 15:29:14 +00:00
),
'a' => array (
'href' => array (),
'title' => array (),
'rel' => array (),
),
'time' => array (
'datetime' => array (),
'class' => array (),
),
)
);
}
}
2019-04-16 23:04:43 +01:00
if ( ! function_exists ( 'storefront_edit_post_link' ) ) {
/**
* Display the edit link
*
* @ since 2.5 . 0
*/
function storefront_edit_post_link () {
edit_post_link (
sprintf (
wp_kses (
/* translators: %s: Name of current post. Only visible to screen readers */
__ ( 'Edit <span class="screen-reader-text">%s</span>' , 'storefront' ),
array (
'span' => array (
'class' => array (),
),
)
),
get_the_title ()
),
'<div class="edit-link">' ,
'</div>'
);
}
}
2018-10-31 15:29:14 +00:00
if ( ! function_exists ( 'storefront_post_taxonomy' ) ) {
2018-11-22 15:13:45 +00:00
/**
* Display the post taxonomies
*
* @ since 2.4 . 0
*/
2018-10-31 15:29:14 +00:00
function storefront_post_taxonomy () {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list ( __ ( ', ' , 'storefront' ) );
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list ( '' , __ ( ', ' , 'storefront' ) );
2016-01-20 16:02:53 +00:00
?>
2018-10-31 15:29:14 +00:00
< aside class = " entry-taxonomy " >
< ? php if ( $categories_list ) : ?>
< div class = " cat-links " >
2019-01-04 19:45:16 +00:00
< ? php echo esc_html ( _n ( 'Category:' , 'Categories:' , count ( get_the_category () ), 'storefront' ) ); ?> <?php echo wp_kses_post( $categories_list ); ?>
2016-02-05 09:55:25 +00:00
</ div >
2019-01-04 19:45:16 +00:00
< ? php endif ; ?>
2016-01-20 16:02:53 +00:00
2018-10-31 15:29:14 +00:00
< ? php if ( $tags_list ) : ?>
< div class = " tags-links " >
2019-01-04 19:45:16 +00:00
< ? php echo esc_html ( _n ( 'Tag:' , 'Tags:' , count ( get_the_tags () ), 'storefront' ) ); ?> <?php echo wp_kses_post( $tags_list ); ?>
2018-10-31 15:29:14 +00:00
</ div >
2019-01-04 19:45:16 +00:00
< ? php endif ; ?>
2016-01-20 16:02:53 +00:00
</ aside >
2018-10-31 15:29:14 +00:00
2016-01-20 16:02:53 +00:00
< ? php
}
}
if ( ! function_exists ( 'storefront_paging_nav' ) ) {
/**
* Display navigation to next / previous set of posts when applicable .
*/
function storefront_paging_nav () {
global $wp_query ;
$args = array (
2018-06-22 15:11:39 +01:00
'type' => 'list' ,
2016-04-11 15:16:11 -05:00
'next_text' => _x ( 'Next' , 'Next post' , 'storefront' ),
'prev_text' => _x ( 'Previous' , 'Previous post' , 'storefront' ),
2018-06-22 15:11:39 +01:00
);
2016-01-20 16:02:53 +00:00
the_posts_pagination ( $args );
}
}
if ( ! function_exists ( 'storefront_post_nav' ) ) {
/**
* Display navigation to next / previous post when applicable .
*/
function storefront_post_nav () {
$args = array (
2018-04-13 18:31:14 +01:00
'next_text' => '<span class="screen-reader-text">' . esc_html__ ( 'Next post:' , 'storefront' ) . ' </span>%title' ,
'prev_text' => '<span class="screen-reader-text">' . esc_html__ ( 'Previous post:' , 'storefront' ) . ' </span>%title' ,
2018-06-22 15:11:39 +01:00
);
2016-01-20 16:02:53 +00:00
the_post_navigation ( $args );
}
}
if ( ! function_exists ( 'storefront_homepage_content' ) ) {
/**
* Display homepage content
* Hooked into the `homepage` action in the homepage template
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ since 1.0 . 0
* @ return void
*/
function storefront_homepage_content () {
2016-02-04 13:16:31 +00:00
while ( have_posts () ) {
the_post ();
2016-01-20 16:02:53 +00:00
2017-01-23 17:54:58 +00:00
get_template_part ( 'content' , 'homepage' );
2016-01-20 16:02:53 +00:00
2016-02-04 13:16:31 +00:00
} // end of the loop.
2016-01-20 16:02:53 +00:00
}
}
if ( ! function_exists ( 'storefront_social_icons' ) ) {
/**
* Display social icons
* If the subscribe and connect plugin is active , display the icons .
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ link http :// wordpress . org / plugins / subscribe - and - connect /
* @ since 1.0 . 0
*/
function storefront_social_icons () {
if ( class_exists ( 'Subscribe_And_Connect' ) ) {
echo '<div class="subscribe-and-connect-connect">' ;
subscribe_and_connect_connect ();
echo '</div>' ;
}
}
}
if ( ! function_exists ( 'storefront_get_sidebar' ) ) {
/**
* Display storefront sidebar
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ uses get_sidebar ()
* @ since 1.0 . 0
*/
function storefront_get_sidebar () {
get_sidebar ();
}
}
if ( ! function_exists ( 'storefront_post_thumbnail' ) ) {
/**
* Display post thumbnail
2016-02-19 16:57:56 +00:00
*
2016-01-20 16:02:53 +00:00
* @ var $size thumbnail size . thumbnail | medium | large | full | $custom
* @ uses has_post_thumbnail ()
* @ uses the_post_thumbnail
2016-02-19 16:57:56 +00:00
* @ param string $size the post thumbnail size .
2016-01-20 16:02:53 +00:00
* @ since 1.5 . 0
*/
2016-10-03 11:13:18 +01:00
function storefront_post_thumbnail ( $size = 'full' ) {
2016-01-20 16:02:53 +00:00
if ( has_post_thumbnail () ) {
2016-05-26 07:57:50 +02:00
the_post_thumbnail ( $size );
2016-01-20 16:02:53 +00:00
}
}
2016-02-19 16:57:56 +00:00
}
2016-03-18 12:10:14 +00:00
2016-07-12 08:37:41 +02:00
if ( ! function_exists ( 'storefront_primary_navigation_wrapper' ) ) {
/**
* The primary navigation wrapper
*/
function storefront_primary_navigation_wrapper () {
2018-04-13 16:48:52 +01:00
echo '<div class="storefront-primary-navigation"><div class="col-full">' ;
2016-07-12 08:37:41 +02:00
}
2016-03-18 12:10:14 +00:00
}
2016-07-12 08:37:41 +02:00
if ( ! function_exists ( 'storefront_primary_navigation_wrapper_close' ) ) {
/**
* The primary navigation wrapper close
*/
function storefront_primary_navigation_wrapper_close () {
2018-04-13 16:48:52 +01:00
echo '</div></div>' ;
}
}
if ( ! function_exists ( 'storefront_header_container' ) ) {
/**
* The header container
*/
function storefront_header_container () {
echo '<div class="col-full">' ;
}
}
if ( ! function_exists ( 'storefront_header_container_close' ) ) {
/**
* The header container close
*/
function storefront_header_container_close () {
2016-07-26 08:20:51 +02:00
echo '</div>' ;
2016-07-12 08:37:41 +02:00
}
2016-03-18 12:10:14 +00:00
}