';
if ( is_sticky() && is_home() && ! is_paged() ) {
echo '' . esc_html__( 'Sticky', 'ultra' ) . ' ';
}
if ( is_home() && siteorigin_setting( 'blog_post_date' ) || is_archive() && siteorigin_setting( 'blog_post_date' ) || is_search() && siteorigin_setting( 'blog_post_date' ) ) {
echo '' . esc_html( get_the_date( 'j F Y' ) ) . ' ' . esc_html( get_the_modified_date() ) . ' ';
}
if ( is_single() && siteorigin_setting( 'blog_post_date' ) ) {
echo '' . esc_html( get_the_date( 'j F Y' ) ) . ' ' . esc_html( get_the_modified_date() ) . ' ';
}
if ( siteorigin_setting( 'blog_post_author' ) ) {
echo '' . esc_html( get_the_author() ) . ' ';
}
if ( comments_open() && siteorigin_setting( 'blog_post_comment_count' ) ) {
echo '';
}
echo '';
if ( is_single() && siteorigin_setting( 'navigation_post_nav' ) ) {
the_post_navigation( $args = array( 'prev_text' => '', 'next_text' => '', ) );
}
}
endif;
if ( ! function_exists( 'ultra_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function ultra_entry_footer() {
if ( is_single() && has_category() && siteorigin_setting( 'blog_post_cats' ) ) {
echo '' . get_the_category_list( esc_html__( ', ', 'ultra' ) ) . ' ';
}
if ( is_single() && has_tag() && siteorigin_setting( 'blog_post_tags' ) ) {
echo '' . get_the_tag_list( '', esc_html__( ', ', 'ultra' ) ) . ' ';
}
if ( siteorigin_setting( 'blog_edit_link' ) ) {
edit_post_link( esc_html__( 'Edit', 'ultra' ), '', ' ' );
}
}
endif;
if ( ! function_exists( 'ultra_display_logo' ) ) :
/**
* Display the logo.
*/
function ultra_display_logo() {
$logo = siteorigin_setting( 'header_logo' );
$logo = apply_filters( 'ultra_logo_image_id', $logo );
if ( empty( $logo ) ) {
if ( function_exists( 'has_custom_logo' ) && has_custom_logo() ) {
the_custom_logo();
return;
}
// Just display the site title.
$logo_html = '' . get_bloginfo( 'name' ) . ' ';
$logo_html = apply_filters( 'ultra_logo_text', $logo_html );
}
else {
// Load the logo image.
if ( is_array( $logo ) ) {
list ( $src, $height, $width ) = $logo;
}
else {
$image = wp_get_attachment_image_src( $logo, 'full' );
$src = $image[0];
$height = $image[2];
$width = $image[1];
}
// Add the logo attributes.
$logo_attributes = apply_filters( 'ultra_logo_image_attributes', array(
'src' => $src,
'width' => round( $width ),
'height' => round( $height ),
'alt' => sprintf( esc_html__( '%s Logo', 'ultra' ), get_bloginfo( 'name' ) ),
) );
if ( siteorigin_setting( 'header_sticky' ) && siteorigin_setting( 'header_scale' ) ) $logo_attributes['data-scale'] = '1';
$logo_attributes_str = array();
if ( ! empty( $logo_attributes ) ) {
foreach($logo_attributes as $name => $val) {
if ( empty( $val ) ) continue;
$logo_attributes_str[] = $name.'="'.esc_attr($val).'" ';
}
}
$logo_html = apply_filters( 'ultra_logo_image', ' ' );
}
// Echo the image.
echo apply_filters( 'ultra_logo_html', $logo_html );
}
endif;
if ( ! function_exists( 'ultra_jetpack_remove_rp' ) ) :
/**
* Remove Jetpack Related Posts from the bottom of posts.
*/
function ultra_jetpack_remove_rp() {
if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'related-posts' ) ) {
$jprp = Jetpack_RelatedPosts::init();
$callback = array( $jprp, 'filter_add_target_to_dom' );
remove_filter( 'the_content', $callback, 40 );
}
}
endif;
add_filter( 'wp', 'ultra_jetpack_remove_rp', 20 );
if ( ! function_exists( 'ultra_related_posts' ) ) :
/**
* Display related posts in single posts.
*/
function ultra_related_posts( $post_id ) {
if ( function_exists( 'related_posts' ) ) { // Check for YARPP plugin.
related_posts();
} elseif ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'related-posts' ) ) {
echo do_shortcode( '[jetpack-related-posts]' );
} else { // The fallback loop.
$categories = get_the_category( $post_id );
$first_cat = $categories[0]->cat_ID;
$args=array(
'category__in' => array( $first_cat ),
'post__not_in' => array( $post_id ),
'posts_per_page' => 3,
'ignore_sticky_posts' => -1
);
$related_posts = new WP_Query( $args ); ?>
have_posts() ) : ?>
have_posts() ) : $related_posts->the_post(); ?>
'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( 'ultra_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so ultra_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so ultra_categorized_blog should return false.
return false;
}
}
/**
* Flush out the transients used in ultra_categorized_blog.
*/
function ultra_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'ultra_categories' );
}
add_action( 'edit_category', 'ultra_category_transient_flusher' );
add_action( 'save_post', 'ultra_category_transient_flusher' );