' . esc_html( get_the_date() ) . '';
// show author
?>
' . esc_html__( 'Posted in %1$s', 'bike-shop' ) . '', $categories_list ); // WPCS: XSS OK.
}
endif;
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html__( ', ', 'bike-shop' ) );
if ( esc_attr(get_theme_mod( 'show_tags', 1 )) ) :
if ( $tags_list ) {
printf( '
' . esc_html__( 'Tagged %1$s', 'bike-shop' ) . '
', $tags_list ); // WPCS: XSS OK.
}
endif;
}
if ( ! is_single() && ! is_search() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
}
if ( esc_attr(get_theme_mod( 'show_edit', 0 )) ) :
edit_post_link(
sprintf(
/* translators: %s: Name of current post */
esc_html__( 'Edit %s', 'bike-shop' ),
the_title( '"', '"', false )
),
'',
''
);
endif;
}
endif;
/**
* Multi-page navigation.
*/
if ( ! function_exists( 'bike_shop_multipage_nav' ) ) :
function bike_shop_multipage_nav() {
wp_link_pages( array(
'before' => '' . esc_html__( 'Pages:', 'bike-shop' ) . '',
'after' => '
',
'link_before' => '',
'link_after' => '',
'pagelink' => '' . esc_html__( 'Page', 'bike-shop' ) . ' %',
'separator' => ', ',
) );
}
endif;
/**
* Blog pagination when more than one page of post summaries.
* Add classes to next_posts_link and previous_posts_link
*/
add_filter('next_posts_link_attributes', 'bike_shop_posts_link_attributes_1');
add_filter('previous_posts_link_attributes', 'bike_shop_posts_link_attributes_2');
function bike_shop_posts_link_attributes_1() {
return 'class="post-nav-older"';
}
function bike_shop_posts_link_attributes_2() {
return 'class="post-nav-newer"';
}
/**
* Single Post previous or next navigation.
*/
if ( ! function_exists( 'bike_shop_post_pagination' ) ) :
function bike_shop_post_pagination() {
the_post_navigation( array(
'next_text' => '' . esc_html__( 'Next Post', 'bike-shop' ) . ' ' .
'' . esc_html__( 'Next Post:', 'bike-shop' ) . ' ' .
'%title',
'prev_text' => '' . esc_html__( 'Previous Post', 'bike-shop' ) . ' ' .
'' . esc_html__( 'Previous Post:', 'bike-shop' ) . ' ' .
'%title',
) );
}
endif;
/**
* Shim for `the_archive_title()`.
* Display the archive title based on the queried object.
* Custom filter for changing the default archive title labels.
*/
if ( ! function_exists( 'bike_shop_archive_title' ) ) :
function bike_shop_archive_title( $before = '', $after = '' ) {
if ( is_category() ) {
$title = sprintf( ( '%s' ), single_cat_title( '', false ) );
} elseif ( is_tag() ) {
$title = sprintf( __( 'Posts Tagged with %s', 'bike-shop' ), single_tag_title( '', false ) );
} elseif ( is_author() ) {
$title = sprintf( __( 'Posts by %s', 'bike-shop' ), '' . get_the_author() . '' );
} elseif ( is_year() ) {
$title = sprintf( __( 'Posts from: %s', 'bike-shop' ), get_the_date( _x( 'Y', 'yearly archives date format', 'bike-shop' ) ) );
} elseif ( is_month() ) {
$title = sprintf( __( 'Posts from %s', 'bike-shop' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'bike-shop' ) ) );
} elseif ( is_day() ) {
$title = sprintf( __( 'Posts from %s', 'bike-shop' ), get_the_date( _x( 'F j, Y', 'daily archives date format', 'bike-shop' ) ) );
} else {
$title = __( 'Archives', 'bike-shop' );
}
/**
* Filter the archive title.
* @param string $title Archive title to be displayed.
*/
$title = apply_filters( 'get_the_archive_title', $title );
if ( ! empty( $title ) ) {
echo $before . $title . $after; // WPCS: XSS OK.
}
}
endif;
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function bike_shop_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'bike_shop_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( 'bike_shop_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so bike_shop_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so bike_shop_categorized_blog should return false.
return false;
}
}
/**
* Category dropdown
*/
if ( !function_exists( 'bike_shop_categories_dropdown' ) ) :
/**
* Category dropdown
*
* @return array();
*/
function bike_shop_categories_dropdown() {
$bike_shop_categories = get_categories( array( 'hide_empty' => 1 ) );
$bike_shop_categories_lists = array();
$bike_shop_categories_lists['0'] = esc_html__( 'Select Category', 'bike-shop' );
foreach( $bike_shop_categories as $category ) {
$bike_shop_categories_lists[esc_attr( $category->term_id )] = esc_html( $category->name );
}
return $bike_shop_categories_lists;
}
endif;
/**
* Category dropdown
*/
if ( !function_exists( 'bike_shop_product_categories_dropdown' ) ) :
/**
* Category dropdown
*
* @return array();
*/
function bike_shop_product_categories_dropdown() {
$cat_args = array(
'orderby' => 'name',
'order' => 'asc',
'hide_empty' => false,
);
$bike_product_categories = get_terms( 'product_cat', $cat_args );
$bike_product_categories_lists = array();
$bike_product_categories_lists[] = esc_html__( 'Select Category', 'bike-shop' );
foreach( $bike_product_categories as $category ) {
$bike_product_categories_lists[esc_attr( $category->slug )] = esc_html( $category->name );
}
return $bike_product_categories_lists;
}
endif;
/**
* Category checkbox list
*/
if ( !function_exists( 'bike_shop_categories_checklist' ) ) :
/**
* Category list
*
* @return array();
*/
function bike_shop_categories_checklist() {
$bike_shop_categories = get_categories( array( 'hide_empty' => 1 ) );
$bike_shop_categories_lists = array();
foreach( $bike_shop_categories as $category ) {
$bike_shop_categories_lists[absint( $category->term_id )] = esc_html( $category->name ) .' ('. absint( $category->count ) .')';
}
return $bike_shop_categories_lists;
}
endif;
/**
* Category checkbox list
*/
if ( !function_exists( 'bike_shop_product_categories_checklist' ) ) :
/**
* Category list
*
* @return array();
*/
function bike_shop_product_categories_checklist() {
$bike_shop_cat_args = array(
'orderby' => 'name',
'order' => 'asc',
'hide_empty' => false,
);
$bike_shop_product_categories = get_terms( 'product_cat', $bike_shop_cat_args );
$bike_shop_categories_lists = array();
foreach( $bike_shop_product_categories as $category ) {
$bike_shop_categories_lists[$category->slug] = esc_html( $category->name ) .' ('. absint( $category->count ) .')';
}
return $bike_shop_categories_lists;
}
endif;
/**
* bike_shop_entry_meta
*/
if ( !function_exists( 'bike_shop_entry_meta' ) ) :
/**
* Category list
*
* @return array();
*/
function bike_shop_entry_meta() {
?>
' . esc_html( get_the_date() ) . '';
// show author
?>
' . esc_html( $categories[0]->name ) . '';
}
}else {
the_category();
}
}