%s', esc_attr( $class ), esc_url( home_url( '/' ) ), esc_html( get_bloginfo( 'name' ) ) ); } else { printf( '

%s

', esc_attr( $class ), esc_url( home_url( '/' ) ), esc_html( get_bloginfo( 'name' ) ) ); } } endif; if ( ! function_exists( 'maker_site_description' ) ) : /** * Displays site description. */ function maker_site_description() { $class = 'site-description'; if ( ! get_theme_mod( 'display_blogdescription', true ) ) { $class .= ' screen-reader-text'; } printf( '

%s

', esc_attr( $class ), esc_html( get_bloginfo( 'description' ) ) ); } endif; if ( ! function_exists( 'maker_entry_category' ) ) : /** * Displays categories. */ function maker_entry_category() { $categories_list = get_the_category_list( esc_html__( ', ', 'maker' ) ); if ( $categories_list && maker_categorized_blog() ) { printf( '
%s
', $categories_list ); // WPCS: XSS OK. } } endif; if ( ! function_exists( 'maker_jetpack_portfolio_type' ) ) : /** * Displays Jetpack portfolio type. */ function maker_jetpack_portfolio_type() { $categories_list = get_the_term_list( get_the_ID(), 'jetpack-portfolio-type', '', ', ', '' ); if ( $categories_list ) { printf( '
%s
', $categories_list ); // WPCS: XSS OK. } } endif; if ( ! function_exists( 'maker_jetpack_portfolio_tag' ) ) : /** * Displays Jetpack portfolio tag. */ function maker_jetpack_portfolio_tag() { $categories_list = get_the_term_list( get_the_ID(), 'jetpack-portfolio-tag', '', ', ', '' ); if ( $categories_list ) { printf( '
%s
', $categories_list ); // WPCS: XSS OK. } } endif; if ( ! function_exists( 'maker_portfolio_toolkit_category' ) ) : /** * Displays Portfolio Toolkit's portfolio category. */ function maker_portfolio_toolkit_category() { $categories_list = get_the_term_list( get_the_ID(), 'portfolio-category', '', ', ', '' ); if ( $categories_list ) { printf( '
%s
', $categories_list ); // WPCS: XSS OK. } } endif; if ( ! function_exists( 'maker_portfolio_toolkit_tag' ) ) : /** * Displays Portfolio Toolkit's portfolio tag. */ function maker_portfolio_toolkit_tag() { $tags_list = get_the_term_list( get_the_ID(), 'portfolio-tag', '', ', ', '' ); if ( $tags_list ) { printf( '
%s
', $tags_list ); // WPCS: XSS OK. } } endif; if ( ! function_exists( 'maker_entry_author' ) ) : /** * Displays link to all posts written by an author of the current post. */ function maker_entry_author() { printf( '%s', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() ); } endif; if ( ! function_exists( 'maker_entry_date' ) ) : /** * Displays Date of the current post. */ function maker_entry_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() ) ); printf( '%s', // WPCS: XSS OK. esc_url( get_permalink() ), $time_string ); } endif; if ( ! function_exists( 'maker_pageviews' ) ) : /** * Displays Date of the current post. */ function maker_pageviews() { if ( ! has_action( 'pageviews' ) ) { return; } printf( '%1$s %2$s', // WPCS: XSS OK. Pageviews::get_placeholder( get_the_ID() ), '' ); } endif; if ( ! function_exists( 'maker_entry_comments_link' ) ) : /** * Prints HTML with a link to post comments. */ function maker_entry_comments_link() { if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { if ( intval( get_comments_number() ) == 0 ) { return; } echo ''; comments_popup_link( __( 'Leave a comment', 'maker' ), __( 'One Comment', 'maker' ), __( '% Comments', 'maker' ) ); echo ''; } } endif; if ( ! function_exists( 'maker_entry_meta_before_content' ) ) : /** * Prints HTML with meta information for the current post. */ function maker_entry_meta_before_content() { // Only display meta on posts. if ( 'post' == get_post_type() ) { echo '
'; maker_entry_category(); maker_entry_author(); maker_entry_date(); maker_entry_comments_link(); edit_post_link( __( 'Edit', 'maker' ), '', '' ); maker_pageviews(); echo '
'; } } endif; if ( ! function_exists( 'maker_portfolio_project_excerpt' ) ) : /** * Displays excerpt set manually. */ function maker_portfolio_project_excerpt() { global $post; if ( $post->post_excerpt ) { if ( is_customize_preview() ) { printf( '

%2$s

', get_theme_mod( 'project_display_excerpt', 1 ) ? '' : 'screen-reader-text', wp_kses_post( $post->post_excerpt ) ); } else { if ( get_theme_mod( 'project_display_excerpt', 1 ) ) { printf( '

%1$s

', wp_kses_post( $post->post_excerpt ) ); } } } } endif; if ( ! function_exists( 'maker_portfolio_project_meta' ) ) : /** * Prints project meta for Portfolio Toolkit posts. */ function maker_portfolio_project_meta() { // Return if we don't need to display meta. if ( ! get_theme_mod( 'project_display_meta', 1 ) && ! is_customize_preview() ) { return; } if ( is_singular( 'portfolio' ) ) : $client = get_post_meta( get_the_ID(), '_portfolio_toolkit_project_client', true ); $date = get_post_meta( get_the_ID(), '_portfolio_toolkit_project_date', true ); $url = get_post_meta( get_the_ID(), '_portfolio_toolkit_project_url', true ); $categories = get_the_term_list( get_the_ID(), 'portfolio-category', '', ', ', '' ); $tags = get_the_term_list( get_the_ID(), 'portfolio-tag', '', ', ', '' ); else : $categories = get_the_term_list( get_the_ID(), 'jetpack-portfolio-type', '', ', ', '' ); $tags = get_the_term_list( get_the_ID(), 'jetpack-portfolio-tag', '', ', ', '' ); endif; if ( $client || $date || $url || $categories || $tags ) : printf( '
', ! get_theme_mod( 'project_display_meta', 1 ) && is_customize_preview() ? 'screen-reader-text' : '' ); // Client. if ( $client ) : printf( '', esc_html__( 'Client', 'maker' ), esc_html( $client ) ); endif; // Date. if ( $date ) : printf( '', esc_html__( 'Date', 'maker' ), esc_html( $date ) ); endif; // URL. if ( $url ) : $parsed = parse_url( $url ); $domain = preg_replace( '/^www\./', '', $parsed['host'] ); printf( '', esc_html__( 'Link', 'maker' ), '' . esc_html( $domain ) ); endif; // Category. if ( $categories ) : printf( // WPCS: XSS OK. '', esc_html__( 'Category', 'maker' ), $categories ); endif; // Tag. if ( $tags ) : printf( // WPCS: XSS OK. '', esc_html__( 'Tags', 'maker' ), $tags ); endif; echo '
%s%s
%s%s
%s%s
%s%s
%s%s
'; endif; } endif; if ( ! function_exists( 'maker_entry_meta_after_content' ) ) : /** * Prints HTML with meta after page content. */ function maker_entry_meta_after_content() { // Hide category and tag text for pages. if ( 'post' == get_post_type() ) { $tags_list = get_the_tag_list( '', '' ); if ( $tags_list ) { printf( '', $tags_list ); // WPCS: XSS OK. } } elseif ( 'page' == get_post_type() && current_user_can( 'edit_pages' ) ) { echo ''; } } endif; if ( ! function_exists( 'maker_post_thumbnail' ) ) : /** * Displays post thumbnail. * * Wraps the post thumbnail in an anchor element on index * view, or a div element on single view. */ function maker_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } if ( 'jetpack-portfolio' == get_post_type() || 'portfolio' == get_post_type() ) { printf( '', esc_url( apply_filters( 'the_permalink', get_permalink() ) ) ); the_post_thumbnail( '480x480' ); echo ''; } elseif ( is_singular() ) { echo '
'; if ( is_active_sidebar( 'sidebar-1' ) ) { the_post_thumbnail( '738x0' ); } else { the_post_thumbnail( '996x0' ); } echo '
'; } else { printf( '', esc_url( apply_filters( 'the_permalink', get_permalink() ) ) ); if ( is_active_sidebar( 'sidebar-1' ) ) { the_post_thumbnail( '738x0' ); } else { the_post_thumbnail( '996x0' ); } echo ''; } } endif; if ( ! function_exists( 'maker_posts_pagination' ) ) : /** * Displays Posts Navigation a.k.a Older/Newer posts links on a blog/archive page. */ function maker_posts_pagination() { $args = array( 'prev_text' => __( 'Newer', 'maker' ), 'next_text' => __( 'Older', 'maker' ), 'screen_reader_text' => __( 'Posts navigation', 'maker' ), ); the_posts_pagination( $args ); } endif; if ( ! function_exists( 'maker_post_navigation' ) ) : /** * Displays Post Navigation a.k.a Next/Previous Post links on a single post page. */ function maker_post_navigation() { $args = array( 'prev_text' => '%title', 'next_text' => '%title', 'screen_reader_text' => __( 'Post navigation', 'maker' ), ); $previous = get_previous_post_link( '', $args['prev_text'] ); $next = get_next_post_link( '', $args['next_text'] ); // Only add markup if there's somewhere to navigate to. if ( $previous || $next ) { echo _navigation_markup( $next . $previous, 'post-navigation', $args['screen_reader_text'] ); // WPCS: XSS OK. } } endif; if ( ! function_exists( 'maker_get_portfolio_all_projects_link' ) ) : /** * Returns the markup for the "All Projects" link. * * @return string Link Markup. */ function maker_get_portfolio_all_projects_link() { // Detect the type of the link. switch ( get_theme_mod( 'portfolio_all_projects_link_type', 'archive' ) ) { case 'frontpage': $url = get_site_url(); break; case 'custom': $url = get_theme_mod( 'project_all_projects_link', get_post_type_archive_link( get_post_type() ) ); break; default: $url = get_post_type_archive_link( get_post_type() ); break; } // Return the link. return sprintf( '%2$s', esc_url( $url ), esc_html__( 'All Projects', 'maker' ) ); } endif; if ( ! function_exists( 'maker_portfolio_navigation' ) ) : /** * Displays Post Navigation a.k.a Next/Prev Post links on a single post page. */ function maker_portfolio_navigation() { $prev = ''; $next = ''; // Get URLs of a previous and next portfolio items. $prev_url = get_permalink( get_adjacent_post( false, '', false ) ); $next_url = get_permalink( get_adjacent_post( false, '', true ) ); if ( get_permalink() != $prev_url ) { $prev = sprintf( '', esc_url( $prev_url ), esc_html__( 'Prev', 'maker' ) ); } if ( get_permalink() != $next_url ) { $next = sprintf( '', esc_url( $next_url ), esc_html__( 'Next', 'maker' ) ); } // Only add markup if there's somewhere to navigate to. if ( $prev || $next ) { echo _navigation_markup( $prev . maker_get_portfolio_all_projects_link() . $next, 'pagination', __( 'Portfolio navigation', 'maker' ) ); // WPCS: XSS OK. } } endif; if ( ! function_exists( 'maker_comment_navigation' ) ) : /** * Displays Comment Navigation. */ function maker_comment_navigation() { if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?> ThemePatio' ); } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function maker_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'maker_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( 'maker_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so maker_categorized_blog should return true. return true; } else { // This blog has only 1 category so maker_categorized_blog should return false. return false; } } /** * Flush out the transients used in maker_categorized_blog. */ function maker_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } delete_transient( 'maker_categories' ); } add_action( 'edit_category', 'maker_category_transient_flusher' ); add_action( 'save_post', 'maker_category_transient_flusher' );