function canary_sidebars(){
$sidebars=array(
array(
'name' => __( LJ_THEME_NAME.' Widget Area','canary' ),
'id' => LJ_THEME_SLUG.'_sidebar',
'description' => __( 'Add widgets here to appear in your sidebar.','canary' ),
'before_widget' => '',
'before_title' => '
',
)
);
return $sidebars;
}
// Customizer settings ----------->
function canary_customize_partial_blogname() {
bloginfo( 'name' );
}
function canary_customize_partial_blogdescription() {
bloginfo( 'description' );
}
// checking for active sidebar ----------->
function canary_active_sidebars(){
foreach(canary_sidebars() as $sidebar){
if ( is_active_sidebar($sidebar['id']) ) {
return true ;
}else{
continue;
}
}
return false;
}
// Post entery metas --------------->
function canary_entry_meta()
{
echo '';
// sticky post ------------->
if ( is_sticky() && is_home() && ! is_paged() ) {
echo ' '.esc_html__( 'Featured','canary' ).' ';
}
// post format ------------->
$format = get_post_format();
$formats_class=array(
'aside'=>'file-text',
'image'=>'image',
'video'=>'video-camera',
'quote'=>'quote-left',
'link'=>'link',
'gallery'=>'image',
'status'=>'thumb-tack',
'audio'=>'music',
'chat'=>'commenting-o',
);
if ( current_theme_supports( 'post-formats', $format ) ) {
echo '
'.esc_html__( 'Format:','canary' ) .'
'.esc_html(get_post_format_string( $format )).' ';
}
// Time ------------->
echo '
'.esc_html__( 'Posted on:','canary' ).'
'.get_the_date().'
'. esc_html(get_the_modified_date()).'
';
// Author ---->
echo '
'. esc_html__( 'Author:','canary' ).'
'.esc_html(get_the_author()).'
';
// categories ---->
$categories_list = get_the_category_list( ', ' );
if ( $categories_list && canary_categorized_blog() ) {
echo '
'. esc_html__( 'Categories:','canary' ).'
'.ent2ncr($categories_list).'
';
}
// tags ---->
$tags_list = get_the_tag_list( '', ', ' );
if ( $tags_list ) {
echo '
'. esc_html__( 'Tags:','canary' ).'
'.ent2ncr($tags_list).'
';
}
// attachemnt ---->
if ( is_attachment() && wp_attachment_is_image() ) {
// Retrieve attachment metadata.
$metadata = wp_get_attachment_metadata();
echo '
'.esc_html__( 'Full size link:','canary' ).'
'.esc_html($metadata['width']).' × '.esc_html($metadata['height']).'
';
}
// Comments ---->
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
}
// Edit Link ---->
edit_post_link( esc_html__( 'Edit','canary' ), ' ', ' ' );
echo ' ';
}
function canary_categorized_blog()
{
if ( false === ( $all_the_cool_cats = get_transient( LJ_THEME_SLUG.'_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,
'number' => 2,
));
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats );
set_transient( LJ_THEME_SLUG.'_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so canary_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so canary_categorized_blog should return false.
return false;
}
}
// Post featured image --------------->
function canary_post_thumbnail( $size='',$id='')
{
if( !($size=trim($size)) ){
$size='medium';
}
if( !($id=trim($id)) ){
$id=get_the_ID();
}
if(has_post_thumbnail($id)){
echo '';
}
}
// Home page validation --------------->
function canary_is_home_page(){
if ( is_home() && is_front_page()) {
return true;
}else{
return false;
}
}
// Displays the optional custom logo --------------->
function canary_the_custom_logo()
{
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
echo ' ';
the_custom_logo();
}else{
echo '
';
if(canary_is_home_page()){
echo '
';
} else{
echo '
'.esc_html(get_bloginfo( 'name' )).'
';
}
if ( $description = get_bloginfo( 'description', 'display' )){
echo '
'.esc_html($description).'
';
}
}
echo '
';
}
// Author's meta ---------------->
function canary_author_metas($author_id)
{
echo '
';
}
?>