%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( /* translators: a link with the date of the post */ esc_html_x( 'Posted on %s', 'post date', 'brand' ), '' . $time_string . '' ); $byline = sprintf( /* translators: a link to the author of the post */ esc_html_x( 'by %s', 'post author', 'brand' ), ' ' ); if( function_exists('brand_get_default_blog') ) { $brand_settings = wp_parse_args( get_option( 'brand_settings', array() ), brand_get_default_blog() ); if($brand_settings['show_date'] === 'no') { $posted_on=''; } if($brand_settings['show_author'] === 'no') { $byline=''; } } echo '' . $posted_on . ' '; // WPCS: XSS OK. } endif; if ( ! function_exists( 'brand_show_categories' ) ) : function brand_show_categories() { if( function_exists('brand_get_default_blog') ) { $brand_settings = wp_parse_args( get_option( 'brand_settings', array() ), brand_get_default_blog() ); if($brand_settings['show_categories'] === 'no') { return false; } else { return true; } } return true; } endif; if ( ! function_exists( 'brand_show_tags' ) ) : function brand_show_tags() { if( function_exists('brand_get_default_blog') ) { $brand_settings = wp_parse_args( get_option( 'brand_settings', array() ), brand_get_default_blog() ); if($brand_settings['show_tags'] === 'no') { return false; } else { return true; } } return true; } endif; if ( ! function_exists( 'brand_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function brand_entry_footer() { // 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( esc_html__( ', ', 'brand' ) ); if ( $categories_list && brand_categorized_blog() && brand_show_categories() ) { printf( ' ' . esc_html( '%1$s' ) . '', $categories_list ); // WPCS: XSS OK. } /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html__( ', ', 'brand' ) ); if ( $tags_list && brand_show_tags() ) { printf( ' ', $tags_list ); // WPCS: XSS OK. } } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ' '; comments_popup_link( esc_html__( 'Leave a comment', 'brand' ), esc_html__( '1 Comment', 'brand' ), esc_html__( '% Comments', 'brand' ) ); echo ''; } edit_post_link( sprintf( /* translators: %s: Name of current post */ esc_html__( 'Edit %s', 'brand' ), the_title( '"', '"', false ) ), '', '' ); } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function brand_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'brand_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 = count( $all_the_cool_cats ); set_transient( 'brand_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so brand_categorized_blog should return true. return true; } else { // This blog has only 1 category so brand_categorized_blog should return false. return false; } } /** * Flush out the transients used in brand_categorized_blog. */ function brand_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'brand_categories' ); } add_action( 'edit_category', 'brand_category_transient_flusher' ); add_action( 'save_post', 'brand_category_transient_flusher' ); if ( ! function_exists( 'brand_excerpt_more' ) && ! is_admin() ) : /** * Replaces "[...]" (appended to automatically generated excerpts) with ... and * a 'Continue reading' link. * * Create your own brand_excerpt_more() function to override in a child theme. * * @since Brand 1.0.0 * * @return string 'Continue reading' link prepended with an ellipsis. */ function brand_excerpt_more() { $link = sprintf( '%2$s', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ sprintf( __( 'Continue reading "%s"', 'brand' ), get_the_title( get_the_ID() ) ) ); return ' … ' . $link; } add_filter( 'excerpt_more', 'brand_excerpt_more' ); endif; if ( ! function_exists( 'brand_show_excerpt' )) : function brand_show_excerpt() { $brand_settings = wp_parse_args( get_option( 'brand_settings', array() ), brand_get_defaults() ); $show_excerpt = $brand_settings['show_excerpt']; return $show_excerpt; } endif; if ( ! function_exists( 'brand_logo_urls' ) ) : function brand_logo_urls() { $brand_settings = wp_parse_args( get_option( 'brand_settings', array() ), brand_get_defaults() ); $logo_url = ! empty( $brand_settings['logo_url'] ) ? $brand_settings['logo_url'] : 0; $logo_mobile_url = ! empty( $brand_settings['logo_mobile_url'] ) ? $brand_settings['logo_mobile_url'] : 0; $logos = array( 'logo' => $logo_url, 'logo_mobile' => $logo_mobile_url ); return $logos; } endif; if ( ! function_exists( 'brand_nav_search_icon' ) ) : /** * Add search icon to primary menu if set * * @since 1.0 */ add_filter( 'wp_nav_menu_items','brand_nav_items', 10, 2 ); function brand_nav_items( $nav, $args ) { $brand_settings = wp_parse_args( get_option( 'brand_settings', array() ), brand_get_defaults() ); // If the search icon isn't enabled, return the regular nav if ( 'enabled' !== $brand_settings['nav_search'] ) return $nav; // If the search icon isn't enabled, return the regular nav if ( 'enabled' !== $brand_settings['nav_search'] ) return $nav; // If our primary menu is set, add the search icon if( $args->theme_location == 'primary' ) return $nav . '