Skip to content

Commit

Permalink
Sync content function with latest WooCommerce template. see #15.
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanrice committed Jan 30, 2018
1 parent 013e051 commit 376a864
Showing 1 changed file with 57 additions and 65 deletions.
122 changes: 57 additions & 65 deletions lib/template-loader.php
Expand Up @@ -135,27 +135,27 @@ function gencwooc_get_template_part( $slug, $name = '' ) {

global $woocommerce;
$template = '';

// Look in yourtheme/slug-name.php and yourtheme/woocommerce/slug-name.php
if ( $name )
if ( $name )
$template = locate_template( array ( "{$slug}-{$name}.php", "{$woocommerce->template_url}{$slug}-{$name}.php" ) );

// Get default slug-name.php
if ( !$template && $name && file_exists( $woocommerce->plugin_path() . "/templates/{$slug}-{$name}.php" ) )
$template = $woocommerce->plugin_path() . "/templates/{$slug}-{$name}.php";

// If template file doesn't exist, look in yourtheme/slug.php and yourtheme/woocommerce/slug.php
if ( !$template )
if ( !$template )
$template = locate_template( array ( "{$slug}.php", "{$woocommerce->template_url}{$slug}.php" ) );

if ( $template )
if ( $template )
load_template( $template, false );
}


/**
* Display shop items
*
*
* FOR BACKWARDS COMPATIBILITY with WooCommerce versions pre-1.6.0
*
* Uses WooCommerce structure and contains all existing WooCommerce hooks
Expand Down Expand Up @@ -238,73 +238,65 @@ function genesiswooc_product_taxonomy() {
* @updated 0.9.8
*/
function genesiswooc_content_product() {
?>
<?php
/**
* woocommerce_before_main_content hook
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
*/
do_action( 'woocommerce_before_main_content' );
?>

<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
/**
* woocommerce_before_main_content hook
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
*/
do_action( 'woocommerce_before_main_content' );

<h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
if ( apply_filters( 'woocommerce_show_page_title', true ) ) {
echo '<h1 class="woocommerce-products-header__title page-title">';
woocommerce_page_title();
echo '</h1>';
}

<?php endif; ?>

<?php do_action( 'woocommerce_archive_description' ); ?>

<?php if ( have_posts() ) : ?>
do_action( 'woocommerce_archive_description' );

<?php
/**
* woocommerce_before_shop_loop hook
*
* @hooked woocommerce_result_count - 20
* @hooked woocommerce_catalog_ordering - 30
*/
do_action( 'woocommerce_before_shop_loop' );
?>

<?php woocommerce_product_loop_start(); ?>

<?php woocommerce_product_subcategories(); ?>


<?php while ( have_posts() ) : the_post(); ?>

<?php wc_get_template_part( 'content', 'product' ); ?>

<?php endwhile; // end of the loop. ?>

<?php woocommerce_product_loop_end(); ?>

<?php
if ( have_posts() ) {
/**
* Hook: woocommerce_before_shop_loop.
*
* @hooked wc_print_notices - 10
* @hooked woocommerce_result_count - 20
* @hooked woocommerce_catalog_ordering - 30
*/
do_action( 'woocommerce_before_shop_loop' );
woocommerce_product_loop_start();
if ( wc_get_loop_prop( 'total' ) ) {
while ( have_posts() ) {
the_post();
/**
* woocommerce_after_shop_loop hook
* Hook: woocommerce_shop_loop.
*
* @hooked woocommerce_pagination - 10
* @hooked WC_Structured_Data::generate_product_data() - 10
*/
do_action( 'woocommerce_after_shop_loop' );
?>

<?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>

<?php wc_get_template( 'loop/no-products-found.php' ); ?>

<?php endif; ?>

<?php
do_action( 'woocommerce_shop_loop' );
wc_get_template_part( 'content', 'product' );
}
}
woocommerce_product_loop_end();
/**
* Hook: woocommerce_after_shop_loop.
*
* @hooked woocommerce_pagination - 10
*/
do_action( 'woocommerce_after_shop_loop' );
} else {
/**
* woocommerce_after_main_content hook
* Hook: woocommerce_no_products_found.
*
* @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
* @hooked wc_no_products_found - 10
*/
do_action( 'woocommerce_after_main_content' );
?>
do_action( 'woocommerce_no_products_found' );
}
/**
* Hook: woocommerce_after_main_content.
*
* @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
*/
do_action( 'woocommerce_after_main_content' );

<?php
}
}

0 comments on commit 376a864

Please sign in to comment.