/**
 * Templates are in the 'templates' folder. jigoshop looks for theme 
 *
 * Overides in /theme/jigoshop/ by default, but can be overwritten with JIGOSHOP_TEMPLATE_URL
 *
 * DISCLAIMER
 *
 * Do not edit or add directly to this file if you wish to upgrade Jigoshop to newer
 * versions in the future. If you wish to customise Jigoshop core for your needs,
 * please use our GitHub repository to publish essential changes for consideration.
 *
 * @package    Jigoshop
 * @category   Core
 * @author     Jigowatt
 * @copyright  Copyright (c) 2011 Jigowatt Ltd.
 * @license    http://jigoshop.com/license/commercial-edition
 */

function jigoshop_template_loader( $template ) {
	
	if ( is_single() && get_post_type() == 'product' ) {
		
		jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-product' ) );
		
		$template = locate_template( array( 'single-product.php', JIGOSHOP_TEMPLATE_URL . 'single-product.php' ) );
		
		if ( ! $template ) $template = jigoshop::plugin_path() . '/templates/single-product.php';
		
	}
	elseif ( is_tax('product_cat') ) {
		
		jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-product_cat' ) );
		
		$template = locate_template(  array( 'taxonomy-product_cat.php', JIGOSHOP_TEMPLATE_URL . 'taxonomy-product_cat.php' ) );
		
		if ( ! $template ) $template = jigoshop::plugin_path() . '/templates/taxonomy-product_cat.php';
	}
	elseif ( is_tax('product_tag') ) {
		
		jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-product_tag' ) );
		
		$template = locate_template( array( 'taxonomy-product_tag.php', JIGOSHOP_TEMPLATE_URL . 'taxonomy-product_tag.php' ) );
		
		if ( ! $template ) $template = jigoshop::plugin_path() . '/templates/taxonomy-product_tag.php';
	}
	elseif ( is_post_type_archive('product') ||  is_page( get_option('jigoshop_shop_page_id') )) {

		jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-products' ) );
		
		$template = locate_template( array( 'archive-product.php', JIGOSHOP_TEMPLATE_URL . 'archive-product.php' ) );
		
		if ( ! $template ) $template = jigoshop::plugin_path() . '/templates/archive-product.php';
		
	}
	
	return $template;

}
Example #2
0
function jigoshop_page_body_classes() {
	
	global $jigoshop_body_classes;
	
	$jigoshop_body_classes = (array) $jigoshop_body_classes;
	
	if (is_checkout() || is_page(get_option('jigoshop_pay_page_id'))) jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-checkout' ) );
	
	if (is_cart()) jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-cart' ) );
	
	if (is_page(get_option('jigoshop_thanks_page_id'))) jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-thanks' ) );
	
	if (is_page(get_option('jigoshop_shop_page_id'))) jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-shop' ) );
	
	if (is_page(get_option('jigoshop_myaccount_page_id')) || is_page(get_option('jigoshop_edit_address_page_id')) || is_page(get_option('jigoshop_view_order_page_id')) || is_page(get_option('jigoshop_change_password_page_id'))) jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-myaccount' ) );	
	
}
Example #3
0
function jigoshop_page_body_classes()
{
    global $jigoshop_body_classes;
    $jigoshop_body_classes = (array) $jigoshop_body_classes;
    if (is_order_tracker()) {
        jigoshop_add_body_class(array('jigoshop', 'jigoshop-tracker'));
    }
    if (is_checkout()) {
        jigoshop_add_body_class(array('jigoshop', 'jigoshop-checkout'));
    }
    if (is_cart()) {
        jigoshop_add_body_class(array('jigoshop', 'jigoshop-cart'));
    }
    if (is_page(jigoshop_get_page_id('thanks'))) {
        jigoshop_add_body_class(array('jigoshop', 'jigoshop-thanks'));
    }
    if (is_page(jigoshop_get_page_id('pay'))) {
        jigoshop_add_body_class(array('jigoshop', 'jigoshop-pay'));
    }
    if (is_account()) {
        jigoshop_add_body_class(array('jigoshop', 'jigoshop-myaccount'));
    }
}
/**
 * Templates are in the 'templates' folder. jigoshop looks for theme
 *
 * Overides in /theme/jigoshop/ by default, but can be overwritten with JIGOSHOP_TEMPLATE_URL
 *
 * DISCLAIMER
 *
 * Do not edit or add directly to this file if you wish to upgrade Jigoshop to newer
 * versions in the future. If you wish to customise Jigoshop core for your needs,
 * please use our GitHub repository to publish essential changes for consideration.
 *
 * @package             Jigoshop
 * @category            Core
 * @author              Jigoshop
 * @copyright           Copyright © 2011-2013 Jigoshop.
 * @license             http://jigoshop.com/license/commercial-edition
 */

function jigoshop_template_loader( $template ) {

	if ( is_single() && get_post_type() == 'product' ) {

		jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-product' ) );

		$template = locate_template( array( 'single-product.php', JIGOSHOP_TEMPLATE_URL . 'single-product.php' ) );

		if ( ! $template ) $template = jigoshop::plugin_path() . '/templates/single-product.php';

	}
	elseif ( is_tax('product_cat') ) {

		jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-products', 'jigoshop-product_cat' ) );

		global $posts;
		$templates = array();
		if ( count( $posts ) ) {
			$category = get_the_terms( $posts[0]->ID, 'product_cat' );
			$slug = $category[key($category)]->slug;
 			$templates[] = 'taxonomy-product_cat-' . $slug . '.php';
 			$templates[] = JIGOSHOP_TEMPLATE_URL . 'taxonomy-product_cat-' . $slug . '.php';
		}
 		$templates[] = 'taxonomy-product_cat.php';
 		$templates[] = JIGOSHOP_TEMPLATE_URL . 'taxonomy-product_cat.php';

		$template = locate_template( $templates );

		if ( ! $template ) $template = jigoshop::plugin_path() . '/templates/taxonomy-product_cat.php';
	}
	elseif ( is_tax('product_tag') ) {

		jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-products', 'jigoshop-product_tag' ) );

		global $posts;
		$templates = array();
		if ( count( $posts ) ) {
			$tag = get_the_terms( $posts[0]->ID, 'product_tag' );
			$slug = $tag[key($tag)]->slug;
 			$templates[] = 'taxonomy-product_tag-' . $slug . '.php';
 			$templates[] = JIGOSHOP_TEMPLATE_URL . 'taxonomy-product_tag-' . $slug . '.php';
		}
 		$templates[] = 'taxonomy-product_tag.php';
 		$templates[] = JIGOSHOP_TEMPLATE_URL . 'taxonomy-product_tag.php';

		$template = locate_template( $templates );

		if ( ! $template ) $template = jigoshop::plugin_path() . '/templates/taxonomy-product_tag.php';
	}
	elseif ( is_post_type_archive('product') ||  is_page( jigoshop_get_page_id('shop') )) {

		jigoshop_add_body_class( array( 'jigoshop', 'jigoshop-shop', 'jigoshop-products' ) );

		$template = locate_template( array( 'archive-product.php', JIGOSHOP_TEMPLATE_URL . 'archive-product.php' ) );

		if ( ! $template ) $template = jigoshop::plugin_path() . '/templates/archive-product.php';

	}

	return $template;

}