* @copyright Copyright 2014, Chris Aprea * @link http://wpaxl.com/themes/adoration * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ // Exit if accessed directly defined( 'ABSPATH' ) || exit; /** * Displays the title on single posts, pages, CPTs. Must be used within the loop. * * @since 1.0.0 * @access public * @return void */ function adoration_title() { // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_title', false ); if ( false !== $pre ) { echo $pre; return; } $title = get_the_title(); // $title is empty, exit early if ( 0 === strlen( $title ) ) { return; } ob_start(); ?>
%s', hybrid_get_attr( 'entry-title' ), $title ); ?>
array ( 'class' => array() ), ); // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_paging_nav', false ); if ( false !== $pre ) { echo $pre; return; } // Don't print empty markup if there's only one page. if ( $GLOBALS['wp_query']->max_num_pages < 2 ) { return; } ?> array ( 'class' => array() ), ); // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_post_nav', false ); if ( false !== $pre ) { echo $pre; return; } // Don't print empty markup if there's nowhere to navigate. $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } ?> %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( esc_html_x( 'Posted on %s', 'post date', 'adoration' ), '' . $time_string . '' ); $byline = sprintf( esc_html_x( 'by %s', 'post author', 'adoration' ), '' . esc_html( get_the_author() ) . '' ); echo '' . $posted_on . ' ' . $byline . ''; } /** * Prints HTML with meta information for the categories, tags and comments. * * @since 1.0.0 * @access public * @return void */ function adoration_entry_footer() { // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_entry_footer', false ); if ( false !== $pre ) { echo $pre; return; } // 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__( ', ', 'adoration' ) ); if ( $categories_list && adoration_categorized_blog() ) { printf( '' . esc_html__( 'Posted in %1$s', 'adoration' ) . '', $categories_list ); } /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html__( ', ', 'adoration' ) ); if ( $tags_list ) { printf( '' . esc_html__( 'Tagged %1$s', 'adoration' ) . '', $tags_list ); } } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( esc_html__( 'Leave a comment', 'adoration' ), esc_html__( '1 Comment', 'adoration' ), esc_html__( '% Comments', 'adoration' ) ); echo ''; } edit_post_link( esc_html__( 'Edit', 'adoration' ), '', '' ); } /** * Returns true if a blog has more than 1 category. * * @since 1.0.0 * @access public * @return bool */ function adoration_categorized_blog() { // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_categorized_blog', null ); if ( null !== $pre ) { return $pre; } if ( false === ( $all_the_cool_cats = get_transient( 'adoration_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( 'adoration_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so adoration_categorized_blog should return true. return true; } else { // This blog has only 1 category so adoration_categorized_blog should return false. return false; } } /** * Flush out the transients used in adoration_categorized_blog. */ function adoration_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'adoration_categories' ); } add_action( 'edit_category', 'adoration_category_transient_flusher' ); add_action( 'save_post', 'adoration_category_transient_flusher' ); /** * Display Product Categories. * Hooked into the `homepage` action in the homepage template. * * @since 1.0.0 */ function adoration_homepage_product_categories( $args ) { // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_homepage_product_categories', false ); if ( false !== $pre ) { echo $pre; return; } if ( ! is_woocommerce_activated() ) { return; } $args = array( 'number' => 6, 'columns' => 3, 'child_categories' => 0, 'orderby' => 'name', 'title' => esc_html__( 'Product Categories', 'adoration' ), ); // If using a 1 column layout increase the product columns to fill out the available space. if ( adoration_is_1c_wide_layout() ) { $args['columns'] = 4; $args['number'] = 8; } $content = adoration_product_categories( $args ); adoration_homepage_section( $content, $args['title'] ); } /** * Display Recent Products. * Hooked into the `homepage` action in the homepage template. * * @since 1.0.0 */ function adoration_homepage_recent_products( $args ) { // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_homepage_recent_products', false ); if ( false !== $pre ) { echo $pre; return; } if ( ! is_woocommerce_activated() ) { return; } $args = array( 'per_page' => 6, 'columns' => 3, 'title' => esc_html__( 'Recent Products', 'adoration' ), ); // If using a 1 column layout increase the product columns to fill out the available space. if ( adoration_is_1c_wide_layout() ) { $args['columns'] = 4; $args['per_page'] = 8; } $content = adoration_recent_products( $args ); adoration_homepage_section( $content, $args['title'] ); } /** * Display Featured Products. * Hooked into the `homepage` action in the homepage template. * * @since 1.0.0 */ function adoration_homepage_featured_products( $args ) { // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_homepage_featured_products', false ); if ( false !== $pre ) { echo $pre; return; } if ( ! is_woocommerce_activated() ) { return; } $args = array( 'per_page' => 6, 'columns' => 3, 'title' => esc_html__( 'Featured Products', 'adoration' ), ); // If using a 1 column layout increase the product columns to fill out the available space. if ( adoration_is_1c_wide_layout() ) { $args['columns'] = 4; $args['per_page'] = 8; } $content = adoration_featured_products( $args ); adoration_homepage_section( $content, $args['title'] ); } /** * Display Popular Products. * Hooked into the `homepage` action in the homepage template. * * @since 1.0.0 */ function adoration_homepage_popular_products( $args ) { // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_homepage_popular_products', false ); if ( false !== $pre ) { echo $pre; return; } if ( ! is_woocommerce_activated() ) { return; } $args = array( 'per_page' => 6, 'columns' => 3, 'title' => esc_html__( 'Popular Products', 'adoration' ), ); // If using a 1 column layout increase the product columns to fill out the available space. if ( adoration_is_1c_wide_layout() ) { $args['columns'] = 4; $args['per_page'] = 8; } $content = adoration_best_selling_products( $args ); adoration_homepage_section( $content, $args['title'] ); } /** * Display Top Rated Products. * Hooked into the `homepage` action in the homepage template. * * @since 1.0.0 */ function adoration_homepage_top_rated_products( $args ) { // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_homepage_top_rated_products', false ); if ( false !== $pre ) { echo $pre; return; } if ( ! is_woocommerce_activated() ) { return; } $args = array( 'per_page' => 6, 'columns' => 3, 'title' => esc_html__( 'Top Rated Products', 'adoration' ), ); // If using a 1 column layout increase the product columns to fill out the available space. if ( adoration_is_1c_wide_layout() ) { $args['columns'] = 4; $args['per_page'] = 8; } $content = adoration_top_rated_products( $args ); adoration_homepage_section( $content, $args['title'] ); } /** * Display On Sale Products. * Hooked into the `homepage` action in the homepage template. * * @since 1.0.0 */ function adoration_homepage_on_sale_products( $args ) { // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_homepage_on_sale_products', false ); if ( false !== $pre ) { echo $pre; return; } if ( ! is_woocommerce_activated() ) { return; } $args = array( 'per_page' => 6, 'columns' => 3, 'title' => esc_html__( 'On Sale', 'adoration' ), ); // If using a 1 column layout increase the product columns to fill out the available space. if ( adoration_is_1c_wide_layout() ) { $args['columns'] = 4; $args['per_page'] = 8; } $content = adoration_sale_products( $args ); adoration_homepage_section( $content, $args['title'] ); } /** * Display homepage content. * Hooked into the `homepage` action in the homepage template. * * @since 1.0.0 */ function adoration_homepage_content() { // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_homepage_content', false ); if ( false !== $pre ) { echo $pre; return; } while ( have_posts() ) : the_post(); the_content(); endwhile; // end of the loop. } /** * Displays the various different homepage sections with a title if applicable. * * @since 1.0.0 * @param string $content Section content. * @param string $title Section title. */ function adoration_homepage_section( $content, $title ) { // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_homepage_section', false, $content, $title ); if ( false !== $pre ) { echo $pre; return; } if ( empty( $content ) ) { return; } ?>

>
array ( 'class' => array() ), ); // Allow developers to short-circuit this function. $pre = apply_filters( 'adoration_pre_singular_content', false ); if ( false !== $pre ) { echo $pre; return; } ?>
>

>

'full', 'link_to_post' => false, 'before' => '', 'attachment' => false, ) ); ?>
>
current_post; $featured_post = ( 0 === $current_post && ! is_paged() && is_home() ); if ( $featured_post ) { return; } ?>
current_post; $featured_post = ( 0 === $current_post && ! is_paged() && is_home() ); $thumb_size = ( $featured_post ) ? 'full' : 'adoration-post-thumb'; ?>
> $thumb_size, 'link_to_post' => false, 'before' => '
', 'attachment' => false, 'callback' => 'adoration_no_featured_image', ) ); ?>

' ); ?>
>