/** * Include the appropriate templates for cart66 products * * @param string $template The template to be included * @return string The path to the template to be included */ function cc_template_include($template) { $post_type = get_post_type(); if (is_single() && 'cc_product' == $post_type) { wp_enqueue_script('cc-gallery-toggle', CC_URL . 'resources/js/gallery-toggle.js', 'jquery'); $template = cc_get_template_part('single', 'product'); } elseif (is_post_type_archive('cc_product')) { $template = cc_get_template_part('archive', 'product'); } elseif (is_tax('product-category')) { $template = cc_get_template_part('taxonomy', 'product-category'); } // CC_Log::write( "Considering which template to include:\nTemplate: " . $template . "\nPost type: " . $post_type ); return $template; }
<div class="entry-content"> <ul class="cc-product-list"> <?php while (have_posts()) { the_post(); ?> <?php /* * Include the post format-specific template for the content. If you want to * use this in a child theme, then include a file called called content-___.php * (where ___ is the post format) and that will be used instead. */ cc_get_template_part('content', 'product-grid-item'); ?> <?php } ?> </ul> <?php /** * @hooked cart66_pagination */ do_action('cart66_after_catalog_loop'); ?> </div>
* @package Cart66/Templates * @since 2.0 */ get_header(); ?> <?php do_action('cart66_before_main_content'); ?> <?php while (have_posts()) { the_post(); ?> <?php cc_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> <?php do_action('cart66_after_main_content'); ?> <?php get_sidebar(); get_footer();