';
echo '';
echo '';
}
}
endif;
add_filter( 'amiable_header_image', 'amiable_custom_header_image' );
// Add format image, date, author and comment info to articles on blog pages
if ( ! function_exists( 'amiable_entry_header_meta' ) ) :
function amiable_entry_header_meta() {
if ( is_sticky() ):
$sticky = __('Featured', 'amiable');
echo '' . $sticky . '';
endif;
$format = get_post_format();
if ( current_theme_supports( 'post-formats', $format ) ) {
printf( '%1$s%3$s',
sprintf( '%s', esc_html_x( 'Format', '', 'amiable' ) ),
esc_url( get_post_format_link( $format ) ),
get_post_format_string( $format )
);
}
if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
$time_string = '';
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
$title = get_the_title();
if ($title !=''):
printf( '' . $time_string . '');
else:
printf( '%1$s%3$s',
sprintf( _x( 'Posted on', '', 'amiable' ) ),
esc_url( get_permalink() ),
$time_string
);
endif;
}
if ( 'post' == get_post_type() ) {
if ( is_singular() || is_multi_author() ) {
printf( '',
sprintf( _x( 'Author', '', 'amiable' ) ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_html( get_the_author() )
);
}
}
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
comments_popup_link( esc_html__( 'Leave a response', 'amiable' ), esc_html__( '1 Response', 'amiable' ), esc_html__( '% Responses', 'amiable' ) );
echo '';
}
}
endif;
// Add date to top of article on single pages
if ( ! function_exists( 'amiable_entry_header_meta_single' ) ) :
function amiable_entry_header_meta_single() {
if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
$time_string = '';
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
$title = get_the_title();
if ($title !=''):
printf( '' . $time_string . '');
else:
printf( '%1$s%3$s',
sprintf( _x( 'Posted on', '', 'amiable' ) ),
esc_url( get_permalink() ),
$time_string
);
endif;
}
}
endif;
// Add categories and tags to articles on blog and single pages
if ( ! function_exists( 'amiable_entry_footer_meta' ) ) :
function amiable_entry_footer_meta() {
if ( 'post' == get_post_type() ) {
$categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'amiable' ) );
if ( $categories_list && amiable_categorized_blog() ) {
printf( '%1$s %2$s',
_x( 'Categories', 'Used before category names.', 'amiable' ),
$categories_list
);
}
$tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'amiable' ) );
if ( $tags_list ) {
printf( '',
_x( 'Tags', 'Used before tag names.', 'amiable' ),
$tags_list
);
}
}
}
endif;
// Determine if blog is using at least two categories or not
if ( ! function_exists( 'amiable_categorized_blog' ) ) :
function amiable_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'amiable_categories' ) ) ) {
$all_the_cool_cats = get_categories( array(
'fields' => 'ids',
'hide_empty' => 1,
'number' => 2,
) );
$all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'amiable_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
return true;
} else {
return false;
}
}
endif;
// Flush out the transients used in {@see amiable_categorized_blog()}.
function amiable_category_transient_flusher() {
delete_transient( 'amiable_categories' );
}
add_action( 'edit_category', 'amiable_category_transient_flusher' );
add_action( 'save_post', 'amiable_category_transient_flusher' );
//Add content to article in blog pages if no excerpt or else show the excerpt
if ( ! function_exists( 'amiable_content_excerpt' ) ) :
function amiable_content_excerpt() {
global $post;
if ( empty( $post->post_excerpt ) ) {
the_content( sprintf(__( 'Continue reading %s ', 'amiable' ), the_title( '"', '"', false )) );
wp_link_pages( array(
'before' => '