max_num_pages < 2 ) { return; } ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } ?> %2$s'; 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( _x( 'Posted on %s', 'post date', 'edin' ), '' . $time_string . '' ); $byline = sprintf( _x( 'by %s', 'post author', 'edin' ), '' . esc_html( get_the_author() ) . '' ); echo '' . $posted_on . ' ' . $byline . ''; } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function edin_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'edin_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 = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0; set_transient( 'edin_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so edin_categorized_blog should return true. return true; } else { // This blog has only 1 category so edin_categorized_blog should return false. return false; } } /** * Flush out the transients used in edin_categorized_blog. */ function edin_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'edin_categories' ); } add_action( 'edit_category', 'edin_category_transient_flusher' ); add_action( 'save_post', 'edin_category_transient_flusher' ); if ( ! function_exists( 'edin_entry_meta' ) ) : /** * Prints HTML with meta information for the categories, tags, comments and edit link. */ function edin_entry_meta() { if ( has_post_format() ) { $format = get_post_format(); echo '' . get_post_format_string( $format ) . ''; } /* Hide category and tag text for pages */ if ( 'post' == get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( __( ', ', 'edin' ) ); if ( $categories_list && edin_categorized_blog() ) { printf( '' . __( 'Posted in %1$s', 'edin' ) . '', $categories_list ); } /* translators: used between list items, there is a space after the comma */ the_tags( sprintf( '%s ', esc_html__( 'Tagged', 'edin' ) ), esc_html__( ', ', 'edin' ), '' ); } if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) { echo ''; comments_popup_link( __( 'Leave a comment', 'edin' ), __( '1 Comment', 'edin' ), __( '% Comments', 'edin' ) ); echo ''; } edit_post_link( __( 'Edit', 'edin' ), '', '' ); } endif; if ( ! function_exists( 'edin_additional_class' ) ) : /** * Change the class of the hero area depending on featured image. */ function edin_additional_class() { $jetpack_options = get_theme_mod( 'jetpack_testimonials' ); if ( is_post_type_archive( 'jetpack-testimonial' ) && isset( $jetpack_options['featured-image'] ) && '' != $jetpack_options['featured-image'] ) { $additional_class = 'with-featured-image'; } elseif ( is_archive() || is_search() || is_404() || ( is_page() && ! has_post_thumbnail() ) || ( is_single() && ! edin_has_post_thumbnail() ) ) { $additional_class = 'without-featured-image'; } else { $additional_class = 'with-featured-image'; } return $additional_class; } endif; /** * Add background-image to hero area. */ function edin_hero_background() { $jetpack_options = get_theme_mod( 'jetpack_testimonials' ); if ( is_post_type_archive( 'jetpack-testimonial' ) && isset( $jetpack_options['featured-image'] ) && '' != $jetpack_options['featured-image'] ) { $thumbnail = wp_get_attachment_image_src( (int)$jetpack_options['featured-image'], 'edin-hero' ); $css = '.hero.with-featured-image { background-image: url(' . esc_url( $thumbnail[0] ) . '); }'; wp_add_inline_style( 'edin-style', $css ); } elseif ( is_archive() || is_search() || is_404() || ( is_page() && ! has_post_thumbnail() ) || ( is_single() && ! edin_has_post_thumbnail() ) ) { return; } elseif ( is_page() ) { $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'edin-hero' ); $thumbnail = $thumbnail[0]; $css = '.hero.with-featured-image { background-image: url(' . esc_url( $thumbnail ) . '); }'; wp_add_inline_style( 'edin-style', $css ); } elseif ( is_single() ) { $thumbnail = edin_get_attachment_image_src( get_the_ID(), get_post_thumbnail_id( get_the_ID() ), 'edin-hero' ); $css = '.hero.with-featured-image { background-image: url(' . esc_url( $thumbnail ) . '); }'; wp_add_inline_style( 'edin-style', $css ); } } add_action( 'wp_enqueue_scripts', 'edin_hero_background' ); /** * Display an optional post thumbnail. * * Wraps the post thumbnail in an anchor element on index * views, or a div element when on single views. * * @return void */ function edin_post_thumbnail() { global $post; $formats = get_theme_support( 'post-formats' ); if ( post_password_required() || is_attachment() || ( is_page() && ! has_post_thumbnail() ) || ( is_single() && ! edin_has_post_thumbnail() ) || get_post_format() ) { return; } ?>