From 4f8ef0cd02888bd637b780a0ffe679e8292767a1 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 3 Jan 2013 10:19:52 +0000 Subject: [PATCH] Cleaned up description hooks Closes #2125. --- templates/archive-product.php | 6 ------ woocommerce-hooks.php | 4 ++-- woocommerce-template.php | 27 ++++++++++++++------------- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/templates/archive-product.php b/templates/archive-product.php index 393cba0a4c2..be2e484126b 100644 --- a/templates/archive-product.php +++ b/templates/archive-product.php @@ -27,12 +27,6 @@ get_header('shop'); ?> - - - - - - - - - - - - @@ -237,9 +231,9 @@ if ( ! function_exists( 'woocommerce_page_title' ) ) { } else { - $shop_page = get_post( woocommerce_get_page_id( 'shop' ) ); + $shop_page_id = woocommerce_get_page_id( 'shop' ); - $page_title = apply_filters( 'the_title', ( $shop_page_title = get_option( 'woocommerce_shop_page_title' ) ) ? $shop_page_title : $shop_page->post_title, $shop_page->ID ); + $page_title = apply_filters( 'the_title', ( $shop_page_title = get_option( 'woocommerce_shop_page_title' ) ) ? $shop_page_title : get_the_title( $shop_page_id ), $shop_page_id ); } @@ -291,9 +285,11 @@ if ( ! function_exists( 'woocommerce_taxonomy_archive_description' ) ) { * @return void */ function woocommerce_taxonomy_archive_description() { - $term_description = term_description(); - if ( $term_description && is_tax( array( 'product_cat', 'product_tag' ) ) && get_query_var( 'paged' ) == 0 ) - echo '
' . wpautop( wptexturize( $term_description ) ) . '
'; + if ( is_tax( array( 'product_cat', 'product_tag' ) ) ) { + $term_description = term_description(); + if ( $term_description && get_query_var( 'paged' ) == 0 ) + echo '
' . wpautop( wptexturize( $term_description ) ) . '
'; + } } } if ( ! function_exists( 'woocommerce_product_archive_description' ) ) { @@ -305,9 +301,14 @@ if ( ! function_exists( 'woocommerce_product_archive_description' ) ) { * @subpackage Archives * @return void */ - function woocommerce_product_archive_description( $shop_page ) { - if ( get_query_var( 'paged' ) == 0 ) + function woocommerce_product_archive_description() { + if ( is_post_type_archive( 'product' ) && get_query_var( 'paged' ) == 0 ) { + + $shop_page_id = woocommerce_get_page_id( 'shop' ); + $shop_page = get_post( $shop_page_id ); + echo '
' . apply_filters( 'the_content', $shop_page->post_content ) . '
'; + } } }