'; 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 ''; } if ( is_single() && siteorigin_setting( 'blog_post_date' ) ) { echo ''; } if ( siteorigin_setting( 'blog_post_author' ) ) { echo ''; } if ( comments_open() && siteorigin_setting( 'blog_post_comment_count' ) ) { echo ''; comments_popup_link( esc_html__( 'Leave a comment', 'ultra' ), esc_html__( '1 Comment', 'ultra' ), esc_html__( '% Comments', 'ultra' ) ); 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' ); if ( empty( $logo ) && function_exists( 'has_custom_logo' ) && has_custom_logo() ) { $logo = get_theme_mod( 'custom_logo' ); } $logo = apply_filters( 'ultra_logo_image_id', $logo ); if ( empty( $logo ) ) { // Just display the site title. if ( is_front_page() ) { $logo_html = '

' . get_bloginfo( 'name' ) . '

'; } else { $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_display_logo_text' ) ) : /** * Display the Site Title next to the logo. */ function ultra_display_logo_text() { $logo = siteorigin_setting( 'header_logo' ); if ( empty( $logo ) && function_exists( 'has_custom_logo' ) && has_custom_logo() ) { $logo = get_theme_mod( 'custom_logo' ); } $logo_html = is_front_page() ? $logo_html = '

' . get_bloginfo( 'name' ) . '

' : $logo_html = '

' . get_bloginfo( 'name' ) . '

'; if ( siteorigin_setting( 'header_logo_with_title' ) && ! empty( $logo ) ) : ?> ID == $featured_image_id ) { // Jetpack Lazy Load. if ( class_exists( 'Jetpack_Lazy_Images' ) ) { $attr['class'] .= ' skip-lazy'; } // Smush Lazy Load. if ( class_exists( 'Smush\Core\Modules\Lazy' ) ) { $attr['class'] .= ' no-lazyload'; } // LiteSpeed Cache Lazy Load. if ( class_exists( 'LiteSpeed_Cache' ) ) { $attr['data-no-lazy'] = 1; } } } return $attr; } endif; add_filter( 'wp_get_attachment_image_attributes', 'ultra_featured_image_lazy_load_exclude', 10, 2 ); endif; 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 ); ?> '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' );