' );
endif;
}
endif;
if ( ! function_exists( 'sf_impact_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function sf_impact_posted_on() {
$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' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
$posted_on = sprintf(
esc_html_x( 'Posted on %s', 'post date', 'sf-impact' ),
'' . $time_string . ''
);
$byline = sprintf(
esc_html_x( 'by %s', 'post author', 'sf-impact' ),
'' . esc_html( get_the_author() ) . ''
);
echo '' . ($posted_on) . ' ' . $byline . ''; // WPCS: XSS OK.
}
endif;
if ( ! function_exists( 'sf_impact_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function sf_impact_entry_footer() {
global $sf_impact_Theme_Mods;
// Hide category and tag text for pages only show on single posts.
if (is_single() || is_page())
{
if ( 'post' == get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( __( ', ', 'sf-impact' ) );
if ( $categories_list && sf_impact_categorized_blog() ) {
printf( '', $categories_list );
}
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', __( ', ', 'sf-impact' ) );
if ( $tags_list ) {
printf( '', $tags_list );
}
}
$sf_impact_show_author = $sf_impact_Theme_Mods->getMod('sf_impact_show_author');
if ( is_single() && $sf_impact_show_author ) :
get_template_part( 'template-parts/author-bio' );
endif;
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '
' );
}
}
endif;
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function sf_impact_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'sf_impact_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( 'sf_impact_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so sf_impact_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so sf_impact_categorized_blog should return false.
return false;
}
}
/**
* Flush out the transients used in sf_impact_categorized_blog.
*/
function sf_impact_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'sf_impact_categories' );
}
add_action( 'edit_category', 'sf_impact_category_transient_flusher' );
add_action( 'save_post', 'sf_impact_category_transient_flusher' );
if (!function_exists('sf_impact_thumbnail')):
function sf_impact_thumbnail()
{
global $post, $sf_impact_Theme_Mods;
if ($post->post_type != "page")
{
$sf_impact_post_featured = $sf_impact_Theme_Mods->getMod('sf_impact_post_featured');
$sf_impact_post_header = $sf_impact_Theme_Mods->getMod('sf_impact_post_header'); //Check if this should go in the header instead
}
else
{
$sf_impact_post_featured = $sf_impact_Theme_Mods->getMod('sf_impact_page_featured');
$sf_impact_post_header = $sf_impact_Theme_Mods->getMod('sf_impact_page_header');
}
if ($sf_impact_post_header) //This is going to go into the header instead
return;
$meta = get_post_meta( $post->ID, 'show_featured_image', $sf_impact_post_featured ) ;
$showthumb = esc_attr( get_post_meta( $post->ID, 'show_featured_image', true ) ) != NULL ? esc_attr( get_post_meta( $post->ID, 'show_featured_image', true ) ) : $sf_impact_post_featured;;
if ($showthumb):
?>