' . esc_html__( '%1$s', 'blogyy' ) . '', $categories_list ); // WPCS: XSS OK.
}
}
// Show tags
if( 1 == $show_tag ){
$tags_list = get_the_tag_list( '', esc_html__( ', ', 'blogyy' ) );
if ( $tags_list ) {
printf( '%1$s %2$s',
_x( 'Tagged : ', 'Used before tag names.', 'blogyy' ),
$tags_list
);
}
}
// Show author
if( 1 == $show_author ){
printf( '%1$s %3$s',
_x( 'By :', 'Used before post author name.', 'blogyy' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
get_the_author()
);
}
}
// Show comments
if( 1 == $show_comment ){
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
}
}
// Show edit post link
if( $edit_post == 1 ){
edit_post_link(
sprintf(
/* translators: %s: Name of current post */
esc_html__( 'Edit %s', 'blogyy' ),
the_title( '"', '"', false )
),
'',
''
);
}
}
endif;
if ( ! function_exists( 'blogyy_entry_date' ) ) :
/**
* Prints HTML with date information for current post.
*
* Create your own blogyy_entry_date() function to override in a child theme.
*
* @package Blogyy
*/
function blogyy_entry_date() {
$time_string = '';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
get_the_date(),
esc_attr( get_the_modified_date( 'c' ) ),
get_the_modified_date()
);
printf( '%1$s %3$s',
_x( 'Posted on', 'Used before publish date.', 'blogyy' ),
esc_url( get_permalink() ),
$time_string
);
}
endif;
if ( ! function_exists( 'blogyy_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*
* Create your own blogyy_post_thumbnail() function to override in a child theme.
*
* @package Blogyy
*/
function blogyy_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
if ( is_singular() ) :
?>
the_title_attribute( 'echo=0' ) ) ); ?>
the_title_attribute( 'echo=0' ) ) ); ?>
%2$s',
esc_url( get_permalink( get_the_ID() ) ),
/* translators: %s: Name of current post */
sprintf( __( 'Continue Reading "%s"', 'blogyy' ), get_the_title( get_the_ID() ) )
);
return $link;
}
add_filter( 'excerpt_more', 'blogyy_excerpt_more' );
endif;
if ( ! function_exists( 'blogyy_categorized_blog' ) ) :
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function blogyy_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'blogyy_categories' ) ) ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories( array(
'fields' => 'ids',
// 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( 'blogyy_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so blogyy_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so blogyy_categorized_blog should return false.
return false;
}
}
endif;
/**
* Flushes out the transients used in blogyy_categorized_blog().
*/
function blogyy_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'blogyy_categories' );
}
add_action( 'edit_category', 'blogyy_category_transient_flusher' );
add_action( 'save_post', 'blogyy_category_transient_flusher' );
/**
* Custom styling
*
* @return string
*/
function blogyy_get_custom_style(){
$css = '';
$primary_color = esc_attr( get_theme_mod( 'primary_color' ) );
$main_text_color = esc_attr( get_theme_mod( 'main_text_color' ) );
if ( $main_text_color ) {
$css .= '
.author-info h2.author-title .author-link,
.entry-footer,
.entry-footer a,
article.page .entry-header h1,
article.post_list .entry-header h1,
article.post_list .entry-header h2,
article.post_list h1 a,
article.post_list h2 a,
.comment-metadata,
.pingback .edit-link,
.comment-metadata a,
.pingback .comment-edit-link,
.post_slider_caption h2,
.post_slider_caption h2 a,
.page-links > .page-links-title,
.main-navigation a,
body,
button,
input,
select,
textarea,
h1,
h2,
h3,
h4,
h5,
h6,
a{
color: '.$main_text_color.';
}';
}
if ( $primary_color ) {
/**
* @TODO beautiful output code
*/
$css .= '
.image-navigation a:hover,
.comment-navigation a:hover,
mark, ins,
.readmore a:hover,
.widget_calendar tbody #today a, .widget_calendar tbody #today,
.sidebar .widget .widget-title:after,.footer-top .widget-title::after,
.post_slider_caption h2:after,
.cat-links a,
.cat-links a:hover,
.page-links a:hover,
.page-links a:focus,
article.page .entry-header h1:after,
article.post_list .entry-header h1:after,
article.post_list .entry-header h2:after,
.page-links > span,
.menu-toggle.toggled-on,
.menu-toggle.toggled-on:hover,
.menu-toggle.toggled-on:focus,
.tagcloud a:hover,
.tagcloud a:focus,
.menu-toggle:focus,
.menu-toggle:hover,
.pagination .page-numbers:hover,
.pagination .page-numbers.current,
button,
button[disabled]:hover,
button[disabled]:focus,
input[type="button"],
input[type="button"][disabled]:hover,
input[type="button"][disabled]:focus,
input[type="reset"],
input[type="reset"][disabled]:hover,
input[type="reset"][disabled]:focus,
input[type="submit"],
input[type="submit"][disabled]:hover,
input[type="submit"][disabled]:focus{
background: '.$primary_color.';
}';
$css .= '
.image-navigation a,
.comment-navigation a,
.readmore a:hover,
.comment-reply-link,
.readmore a,
.page-links a,
.page-links > span,
.widget_calendar tbody #today a,
.widget_calendar tbody #today,
.tagcloud a:hover,
.tagcloud a:focus,
.menu-toggle:focus,
.menu-toggle:hover,
.menu-toggle.toggled-on,
.menu-toggle.toggled-on:hover,
.menu-toggle.toggled-on:focus,
.pagination .page-numbers:hover,
.pagination .page-numbers.current,
.pagination .page-numbers,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
input[type="week"]:focus,
input[type="month"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
textarea:focus,
blockquote{
border-color: '.$primary_color.';
}';
$css .= '
.image-navigation a,
.comment-navigation a,
.entry-content a,
.entry-summary a,
.taxonomy-description a,
.comment-content a,
.page-header h1 span,
.post_slider_caption h2 a:hover,
article.post_list h1 a:hover,
article.post_list h2 a:hover,
.readmore a,
.comment-metadata a:hover,
.comment-metadata a:focus,
.pingback .comment-edit-link:hover,
.pingback .comment-edit-link:focus,
.comment-reply-link,
.page-links a,
.author-info h2.author-title .author-link:hover,
.entry-footer a:hover,
.entry-footer a:focus,
.widget_calendar tbody a,
.pagination .page-numbers,
.post-navigation a:hover .post-title,
.post-navigation a:focus .post-title,
.main-navigation li:hover > a,
.main-navigation li.focus > a,
.main-navigation .current-menu-item > a,
.main-navigation .current-menu-ancestor > a,
.site-header a:hover,
a:hover,
a:focus,
a:active,
.sticky-post{
color: '.$primary_color.';
}';
}
return $css;
}