' . esc_html__( 'Tagged %1$s', 'nikko-portfolio' ) . '', $tags_list ); // WPCS: XSS OK. } } } /** * Display category list */ if ( ! function_exists( 'nikko_portfolio_the_category_list' ) ) { function nikko_portfolio_the_category_list() { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( ', ' ); if ( $categories_list && nikko_portfolio_categorized_blog() ) { printf( '', $categories_list ); // WPCS: XSS OK. } } } /** * Returns true if a blog has more than 1 category. * * @return bool */ if ( ! function_exists( 'nikko_portfolio_categorized_blog' ) ) { function nikko_portfolio_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'nikko_portfolio_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( 'nikko_portfolio_categories', $all_the_cool_cats ); } // This blog has more than 1 category so nikko_portfolio_categorized_blog should return true. if ( $all_the_cool_cats > 1 ) { return true; } // This blog has only 1 category so nikko_portfolio_categorized_blog should return false. return false; } } /** * Flush out the transients used in nikko_portfolio_categorized_blog. */ function nikko_portfolio_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'nikko_portfolio_categories' ); } add_action( 'edit_category', 'nikko_portfolio_category_transient_flusher' ); add_action( 'save_post', 'nikko_portfolio_category_transient_flusher' ); if ( ! function_exists( 'nikko_portfolio_search_results_title' ) ) { function nikko_portfolio_search_results_title() { printf( esc_html__( 'Search Results for: %s', 'nikko-portfolio' ), '' . get_search_query() . '' ); } } if ( ! function_exists( 'nikko_portfolio_posted_on' ) ) { /** * Prints HTML with meta information for the current post-date/time and author. */ function nikko_portfolio_posted_on() { $time_string = ''; $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $posted_on = sprintf( esc_html_x( 'Published %s', 'post date', 'nikko-portfolio' ), '' . $time_string . '' ); $byline = sprintf( esc_html_x( 'By %s', 'post author', 'nikko-portfolio' ), '' . esc_html( get_the_author() ) . '' ); echo '' . $posted_on . ' ' . $byline . ''; // WPCS: XSS OK. edit_post_link( sprintf( /* translators: %s: Name of current post */ esc_html__( 'Edit %s', 'nikko-portfolio' ), the_title( '"', '"', false ) ), ' ', '' ); } } if ( ! function_exists( "nikko_portfolio_post_navigation" ) ) { function nikko_portfolio_post_navigation() { // Check if whe have posts to navigate to. $previous = get_previous_post_link( '' ); $next = get_next_post_link( '' ); // Return if there are none. if ( ! $previous && ! $next ) { return; } // Create the markup for the links. $html = _navigation_markup( $previous . $next, 'post-navigation' ); // Filter and echo the navigation. echo apply_filters( 'nikko_portfolio_post_navigation', $html ); // wpcs: xss ok. } }