%1$s%3$s', sprintf( '%s ', _x( 'Format', 'Used before post format.', 'alchemist' ) ), esc_url( get_post_format_link( $format ) ), get_post_format_string( $format ) ); } if ( 'post' === get_post_type() ) { alchemist_entry_taxonomies(); } if ( ! is_singular() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( sprintf( __( 'Leave a comment on %s', 'alchemist' ), get_the_title() ) ); echo ''; } } endif; if ( ! function_exists( 'alchemist_entry_posted_on' ) ) : /** * Prints HTML with date information for current post. * * Create your own alchemist_entry_posted_on() function to override in a child theme. * * @since Alchemist 1.0 */ function alchemist_entry_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' ) ), 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.', 'alchemist' ), esc_url( get_permalink() ), $time_string ); } endif; if ( ! function_exists( 'alchemist_entry_taxonomies' ) ) : /** * Prints HTML with category and tags for current post. * * Create your own alchemist_entry_taxonomies() function to override in a child theme. * * @since Alchemist 1.0 */ function alchemist_entry_taxonomies() { alchemist_entry_category(); alchemist_entry_tags(); } endif; if ( ! function_exists( 'alchemist_entry_category_date' ) ) : /** * Prints HTML with category and tags for current post. * * Create your own alchemist_entry_category_date() function to override in a child theme. * * @since Alchemist 1.0 */ function alchemist_entry_category_date() { echo '
'; alchemist_entry_posted_on(); alchemist_home_entry_category(); echo '
'; } endif; if ( ! function_exists( 'alchemist_entry_header' ) ) : /** * Prints HTML with meta information for the date and author * * Create your own alchemist_entry_header() function to override in a child theme. * * @since Alchemist 1.0 */ function alchemist_entry_header() { echo '
'; $portfolio_categories_list = get_the_term_list( get_the_ID(), 'jetpack-portfolio-type', '', esc_html_x( ', ', 'Used between list items, there is a space after the comma.', 'alchemist' ), '' ); if ( 'jetpack-portfolio' === get_post_type() ) { printf( '%1$s: %2$s', sprintf( _x( 'Categories', 'Used before category names.', 'alchemist' ) ), $portfolio_categories_list ); } $categories_list = get_the_category_list( _x( ' ', 'Used between list items, there is a space after the comma.', 'alchemist' ) ); if ( $categories_list && alchemist_categorized_blog( ) ) { printf( '%1$s%2$s', sprintf( _x( 'Categories', 'Used before category names.', 'alchemist' ) ), $categories_list ); } // Get the author name; wrap it in a link. printf( /* translators: %s: post author */ __( ' By %s', 'alchemist' ), '' . get_the_author() . '' ); // Comments. if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( sprintf( __( 'Leave a comment on %s', 'alchemist' ), get_the_title() ) ); echo ''; } echo '
'; } endif; if ( ! function_exists( 'alchemist_entry_category' ) ) : /** * Prints HTML with category for current post. */ function alchemist_entry_category() { $portfolio_categories_list = get_the_term_list( get_the_ID(), 'jetpack-portfolio-type', '', esc_html_x( ', ', 'Used between list items, there is a space after the comma.', 'alchemist' ), '' ); if ( 'jetpack-portfolio' === get_post_type() ) { printf( '' . alchemist_get_svg( array( 'icon' => 'folder' ) ) . '' . '%1$s: %2$s', sprintf( _x( 'Categories', 'Used before category names.', 'alchemist' ) ), $portfolio_categories_list ); } $categories_list = get_the_category_list( _x( ' ', 'Used between list items, there is a space after the comma.', 'alchemist' ) ); if ( $categories_list && alchemist_categorized_blog( ) ) { printf( '' . alchemist_get_svg( array( 'icon' => 'folder' ) ) . '' . '%1$s%2$s', sprintf( _x( 'Categories', 'Used before category names.', 'alchemist' ) ), $categories_list ); } } endif; if ( ! function_exists( 'alchemist_home_entry_category' ) ) : /** * Prints HTML with category for current post for home page. */ function alchemist_home_entry_category() { $portfolio_categories_list = get_the_term_list( get_the_ID(), 'jetpack-portfolio-type', '', esc_html_x( ', ', 'Used between list items, there is a space after the comma.', 'alchemist' ), '' ); if ( 'jetpack-portfolio' === get_post_type() ) { printf( '' . alchemist_get_svg( array( 'icon' => 'folder' ) ) . '' . '%1$s: %2$s', sprintf( _x( 'Categories', 'Used before category names.', 'alchemist' ) ), $portfolio_categories_list ); } $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'alchemist' ) ); if ( $categories_list && alchemist_categorized_blog( ) ) { printf( 'in%1$s%2$s', sprintf( _x( 'Categories', 'Used before category names.', 'alchemist' ) ), $categories_list ); } } endif; if ( ! function_exists( 'alchemist_slider_entry_category' ) ) : /** * Prints HTML with category and tags for current post. * * Create your own alchemist_entry_category_date() function to override in a child theme. * * @since Alchemist 1.0 */ function alchemist_slider_entry_category() { $meta = '
'; $categories_list = get_the_category_list( ' ' ); if ( $categories_list && alchemist_categorized_blog( ) ) { $meta .= sprintf( '' . '%1$s%2$s', sprintf( _x( 'Categories', 'Used before category names.', 'alchemist' ) ), $categories_list ); } $meta .= '
'; return $meta; } endif; if ( ! function_exists( 'alchemist_entry_date_author' ) ) : /** * Prints HTML with category and tags for current post. * * Create your own alchemist_entry_category_date() function to override in a child theme. * * @since Alchemist 1.0 */ function alchemist_entry_date_author() { $meta = '
'; $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() ) ); $meta .= sprintf( '' . alchemist_get_svg( array( 'icon' => 'calendar' ) ) . '' .'%3$s' . '%1$s%4$s', _x( 'Posted on', 'Used before publish date.', 'alchemist' ), esc_url( get_permalink() ), esc_html__( ' ', 'alchemist' ), $time_string ); // Get the author name; wrap it in a link. $byline = sprintf( /* translators: %s: post author */ __( 'By %s', 'alchemist' ), '' . get_the_author() . '' ); $meta .= sprintf( '' . alchemist_get_svg( array( 'icon' => 'tag' ) ) . '' .'%1$s%2$s', esc_html__( ' ', 'alchemist' ), $byline ); $meta .= '
'; return $meta; } endif; if ( ! function_exists( 'alchemist_entry_tags' ) ) : /** * Prints HTML with tags for current post. */ function alchemist_entry_tags() { $tags_list = get_the_tag_list( '', _x( ' ', 'Used between list items, there is a space after the comma.', 'alchemist' ) ); if ( $tags_list ) { printf( '' . alchemist_get_svg( array( 'icon' => 'tag' ) ) . '' . '%1$s: %2$s', _x( 'Tags', 'Used before tag names.', 'alchemist' ), $tags_list ); } } endif; if ( ! function_exists( 'alchemist_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function alchemist_entry_footer() { // We don't want to output .entry-footer if it will be empty, so make sure its not. if ( has_tag() || ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) || get_edit_post_link() ) { echo ' '; } } endif; if ( ! function_exists( 'alchemist_edit_link' ) ) : /** * Returns an accessibility-friendly link to edit a post or page. * * This also gives us a little context about what exactly we're editing * (post or page?) so that users understand a bit more where they are in terms * of the template hierarchy and their content. Helpful when/if the single-page * layout with multiple posts/pages shown gets confusing. */ function alchemist_edit_link() { edit_post_link( sprintf( /* translators: %s: Name of current post */ __( 'Edit "%s"', 'alchemist' ), get_the_title() ), '', '' ); } endif; if ( ! function_exists( 'alchemist_post_thumbnail' ) ) : /** * Displays an optional post thumbnail. * * Wraps the post thumbnail in an anchor element on index views, or a div * element when on single views. * * Create your own alchemist_post_thumbnail() function to override in a child theme. * * @since Alchemist 1.0 */ function alchemist_post_thumbnail( $size = 'post-thumbnail' ) { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } if ( is_singular() ) : ?>
%2$s', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ wp_kses_data( $more_tag_text ) . '' . get_the_title( get_the_ID() ) . '' ); return ' … ' . $link; } endif; add_filter( 'excerpt_more', 'alchemist_excerpt_more' ); if ( ! function_exists( 'alchemist_custom_excerpt' ) ) : /** * Adds Read More link to more tag excerpts. * * function tied to the get_the_excerpt filter hook. * * @since Alchemist 1.0 */ function alchemist_custom_excerpt( $output ) { if ( has_excerpt() && ! is_attachment() ) { $more_tag_text = get_theme_mod( 'alchemist_excerpt_more_text', esc_html__( 'Continue Reading >', 'alchemist' ) ); // Make Product continue reading different so that Products page has something like Buy Now instead of Continue Reading. if ( 'product' === get_post_type() ) { $more_tag_text = get_theme_mod( 'alchemist_woo_excerpt_more_text', esc_html__( 'Buy Now', 'alchemist' ) ); } $link = sprintf( '%2$s', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ wp_kses_data( $more_tag_text ) . '' . get_the_title( get_the_ID() ) . '' ); $output .= ' … ' . $link; } return $output; } endif; // alchemist_custom_excerpt. add_filter( 'get_the_excerpt', 'alchemist_custom_excerpt' ); if ( ! function_exists( 'alchemist_more_link' ) ) : /** * Replacing Read More link to the_content more. * * function tied to the the_content_more_link filter hook. * * @since Alchemist 1.0 */ function alchemist_more_link( $more_link, $more_link_text ) { $more_tag_text = get_theme_mod( 'alchemist_excerpt_more_text', esc_html__( 'Continue Reading >', 'alchemist' ) ); // Make Product continue reading different so that Products page has something like Buy Now instead of Continue Reading. if ( 'product' === get_post_type() ) { $more_tag_text = get_theme_mod( 'alchemist_woo_excerpt_more_text', esc_html__( 'Buy Now', 'alchemist' ) ); } return str_replace( $more_link_text, wp_kses_post( $more_tag_text ), $more_link ); } endif; // alchemist_more_link. add_filter( 'the_content_more_link', 'alchemist_more_link', 10, 2 ); if ( ! function_exists( 'alchemist_categorized_blog' ) ) : /** * Determines whether blog/site has more than one category. * * Create your own alchemist_categorized_blog() function to override in a child theme. * * @since Alchemist 1.0 * * @return bool True if there is more than one category, false otherwise. */ function alchemist_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'alchemist_categories' ) ) ) { // Create an array of all the categories that are attached to posts. $all_the_cool_cats = get_categories( array( 'fields' => 'ids', // 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( 'alchemist_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so alchemist_categorized_blog should return true. return true; } else { // This blog has only 1 category so alchemist_categorized_blog should return false. return false; } } endif; /** * Flushes out the transients used in alchemist_categorized_blog(). * * @since Alchemist 1.0 */ function alchemist_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'alchemist_categories' ); } add_action( 'edit_category', 'alchemist_category_transient_flusher' ); add_action( 'save_post', 'alchemist_category_transient_flusher' ); if ( ! function_exists( 'alchemist_the_custom_logo' ) ) : /** * Displays the optional custom logo. * * Does nothing if the custom logo is not available. * * @since Alchemist 1.2 */ function alchemist_the_custom_logo() { if ( function_exists( 'the_custom_logo' ) ) { the_custom_logo(); } } endif; /** * Footer Text * * @get footer text from theme options and display them accordingly * @display footer_text * @action alchemist_footer * * @since Alchemist 1.0 */ function alchemist_footer_content() { $theme_data = wp_get_theme(); $footer_copyright = sprintf( _x( 'Copyright © %1$s %2$s. All Rights Reserved. %3$s ', '1: Year, 2: Site Title with home URL, 3: Privacy Policy Link', 'alchemist' ), esc_attr( date_i18n( __( 'Y', 'alchemist' ) ) ), ''. esc_attr( get_bloginfo( 'name', 'display' ) ) . '', get_the_privacy_policy_link() . ' | ' . $theme_data->get( 'Name' ) . ' ' . esc_html__( 'by', 'alchemist' ) . ' ' . esc_html( $theme_data->get( 'Author' ) ) . '' ); $footer_copyright = ''; $footer_content = '
' . $footer_copyright . '
'; echo $footer_content; } add_action( 'alchemist_credits', 'alchemist_footer_content', 10 ); if ( ! function_exists( 'alchemist_comment' ) ) : /** * Template for comments and pingbacks. * Used as a callback by wp_list_comments() for displaying the comments. */ function alchemist_comment( $comment, $args, $depth ) { if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?>
  • >
    ', '' ); ?>
  • >
    says:', 'alchemist' ), sprintf( '%s', get_comment_author_link() ) ); ?>
    'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '', 'after' => '', ) ) ); ?>
    is needed. WordPress will know where to add it. */ ?>