%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() ) ); echo '' . wp_kses_post( $time_string ) . '' . esc_html( get_the_author() ) .''; } endif; /*-----------------------------------------------------------------------------------------------------------------------*/ if( ! function_exists( 'news_vibrant_post_date' ) ) : /** * Post date for hoemapge posts */ function news_vibrant_post_date() { $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() ) ); echo '' . wp_kses_post( $time_string ) . ''; } endif; /*-----------------------------------------------------------------------------------------------------------------------*/ if( ! function_exists( 'news_vibrant_post_author' ) ) : /** * Post author for homepage posts */ function news_vibrant_post_author() { $byline = sprintf( /* translators: %s: post author. */ esc_html_x( 'by %s', 'post author', 'news-vibrant' ), '' . esc_html( get_the_author() ) . '' ); echo ' ' . $byline . ''; } endif; /*-----------------------------------------------------------------------------------------------------------------------*/ if( ! function_exists( 'news_vibrant_post_comment' ) ) : /** * Comment for homepage post */ function news_vibrant_post_comment() { echo ''; comments_popup_link( esc_html__( '0 ', 'news-vibrant' ), esc_html__( '1 ', 'news-vibrant' ), esc_html__( '% ', 'news-vibrant' ) ); echo ''; } endif; /*-----------------------------------------------------------------------------------------------------------------------*/ if ( ! function_exists( 'news_vibrant_inner_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function news_vibrant_inner_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() ) ); echo '' . wp_kses_post( $time_string ) . '' . esc_html( get_the_author() ) .''; if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( esc_html__( '0 ', 'news-vibrant' ), esc_html__( '1 ', 'news-vibrant' ), esc_html__( '% ', 'news-vibrant' ) ); echo ''; } } endif; /*-----------------------------------------------------------------------------------------------------------------------*/ if ( ! function_exists( 'news_vibrant_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function news_vibrant_entry_footer() { if ( is_single() ) { /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list(); if ( $tags_list ) { /* translators: 1: list of tags. */ printf( '' . esc_html__( 'Tagged %1$s', 'news-vibrant' ) . '', $tags_list ); // WPCS: XSS OK. } } edit_post_link( sprintf( wp_kses( /* translators: %s: Name of current post. Only visible to screen readers */ __( 'Edit %s', 'news-vibrant' ), array( 'span' => array( 'class' => array(), ), ) ), get_the_title() ), '', '' ); } endif; /*-----------------------------------------------------------------------------------------------------------------------*/ if( ! function_exists( 'news_vibrant_categorized_blog' ) ) : /** * Returns true if a blog has more than 1 category. * * @return bool */ function news_vibrant_categorized_blog() { $all_the_cool_cats = get_transient( 'news_vibrant_categories' ); if ( false === $all_the_cool_cats ) { // 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( 'news_vibrant_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 || is_preview() ) { // This blog has more than 1 category so news_vibrant_categorized_blog should return true. return true; } else { // This blog has only 1 category so news_vibrant_categorized_blog should return false. return false; } } endif; /*-----------------------------------------------------------------------------------------------------------------------*/ add_action( 'edit_category', 'news_vibrant_category_transient_flusher' ); add_action( 'save_post', 'news_vibrant_category_transient_flusher' ); if( ! function_exists( 'news_vibrant_category_transient_flusher' ) ) : /** * Flush out the transients used in news_vibrant_categorized_blog. */ function news_vibrant_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'news_vibrant_categories' ); } endif; /*-----------------------------------------------------------------------------------------------------------------------*/ if( ! function_exists( 'news_vibrant_post_categories_list' ) ): /** * Categories list in multiple color background * * @since 1.0.0 */ function news_vibrant_post_categories_list() { global $post; $post_id = $post->ID; $categories_list = get_the_category( $post_id ); if ( !empty( $categories_list ) ) { ?>
name; $cat_id = $cat_data->term_id; $cat_link = get_category_link( $cat_id ); ?>