1 && get_option( 'page_comments' ) ) : ?> %s', __( 'Featured', 'cyanotype' ) ); } if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) { $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' ) ), get_the_date(), esc_attr( get_the_modified_date( 'c' ) ), get_the_modified_date() ); printf( '%1$s %3$s', _x( 'Posted on', 'Used before publish date.', 'cyanotype' ), esc_url( get_permalink() ), $time_string ); } } endif; if ( ! function_exists( 'cyanotype_entry_meta' ) ) : /** * Prints HTML with meta information for the categories, tags. * * @since Cyanotype 1.0 */ function cyanotype_entry_meta() { if ( 'post' == get_post_type() ) { $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'cyanotype' ) ); if ( $categories_list && cyanotype_categorized_blog() ) { printf( '%1$s %2$s', _x( 'Categories', 'Used before category names.', 'cyanotype' ), $categories_list ); } /* translators: used between list items, there is a space after the comma */ the_tags( sprintf( '%s ', esc_html__( 'Tags', 'cyanotype' ) ), esc_html__( ', ', 'cyanotype' ), '' ); } if ( 'jetpack-portfolio' == get_post_type() ) { global $post; $project_types_list = get_the_term_list( $post->ID, 'jetpack-portfolio-type', '', _x( ', ', 'Used between list items, there is a space after the comma.', 'cyanotype' ), '' ); if ( $project_types_list ) { printf( '%1$s %2$s', _x( 'Project Types', 'Used before project type names.', 'cyanotype' ), $project_types_list ); } $project_tag_list = get_the_term_list( $post->ID, 'jetpack-portfolio-tag', '', _x( ', ', 'Used between list items, there is a space after the comma.', 'cyanotype' ), '' ); if ( $project_tag_list ) { printf( '%1$s %2$s', _x( 'Project Tags', 'Used before project tag names.', 'cyanotype' ), $project_tag_list ); } } if ( is_attachment() && wp_attachment_is_image() ) { // Retrieve attachment metadata. $metadata = wp_get_attachment_metadata(); printf( '%1$s %3$s × %4$s', _x( 'Full size', 'Used before full size attachment link.', 'cyanotype' ), esc_url( wp_get_attachment_url() ), $metadata['width'], $metadata['height'] ); } if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( __( 'Leave a comment', 'cyanotype' ), __( '1 Comment', 'cyanotype' ), __( '% Comments', 'cyanotype' ) ); echo ''; } } endif; /** * Determine whether blog/site has more than one category. * * @since Cyanotype 1.0 * * @return bool True of there is more than one category, false otherwise. */ function cyanotype_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'cyanotype_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( 'cyanotype_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so cyanotype_categorized_blog should return true. return true; } else { // This blog has only 1 category so cyanotype_categorized_blog should return false. return false; } } /** * Flush out the transients used in {@see cyanotype_categorized_blog()}. * * @since Cyanotype 1.0 */ function cyanotype_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'cyanotype_categories' ); } add_action( 'edit_category', 'cyanotype_category_transient_flusher' ); add_action( 'save_post', 'cyanotype_category_transient_flusher' ); if ( ! function_exists( 'cyanotype_excerpt_more' ) && ! is_admin() ) : /** * Replaces "[...]" (appended to automatically generated excerpts) with ... and a 'Continue reading' link. * * @since Cyanotype 1.0 * * @return string 'Continue reading' link prepended with an ellipsis. */ function cyanotype_excerpt_more( $more ) { $link = sprintf( '%2$s', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ sprintf( __( 'Continue reading %s', 'cyanotype' ), '' . get_the_title( get_the_ID() ) . '' ) ); return ' … ' . $link; } add_filter( 'excerpt_more', 'cyanotype_excerpt_more' ); endif; if ( ! function_exists( 'cyanotype_post_thumbnail' ) ) : /** * Display an optional post thumbnail. * * Wraps the post thumbnail in an anchor element on index views, or a div * element when on single views. * * @since Cyanotype 1.0 */ function cyanotype_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } if ( is_singular() ) : ?>