From d96661f45bca15d725f8ca86e52b30816ddf215a Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 25 Nov 2013 14:35:10 +0000 Subject: [PATCH] Reverted template function names for @jameskoster's sanity --- includes/wc-deprecated-functions.php | 312 ------------------ includes/wc-template-functions.php | 460 +++++++++++++-------------- includes/wc-template-hooks.php | 16 +- 3 files changed, 231 insertions(+), 557 deletions(-) diff --git a/includes/wc-deprecated-functions.php b/includes/wc-deprecated-functions.php index ea7e421b8df..522c3293c1a 100644 --- a/includes/wc-deprecated-functions.php +++ b/includes/wc-deprecated-functions.php @@ -148,318 +148,6 @@ function woocommerce_change_term_counts( $terms, $taxonomies, $args ) { wc_change_term_counts( $terms, $taxonomies, $args ); } -/** - * Template functions - soft deprecated - */ -function woocommerce_template_redirect() { - wc_template_redirect(); -} -if ( ! function_exists( 'woocommerce_output_content_wrapper' ) ) { - function woocommerce_output_content_wrapper() { - wc_output_content_wrapper(); - } -} -if ( ! function_exists( 'woocommerce_output_content_wrapper_end' ) ) { - function woocommerce_output_content_wrapper_end() { - wc_output_content_wrapper_end(); - } -} -if ( ! function_exists( 'woocommerce_get_sidebar' ) ) { - function woocommerce_get_sidebar() { - wc_get_sidebar(); - } -} -if ( ! function_exists( 'woocommerce_demo_store' ) ) { - function woocommerce_demo_store() { - wc_demo_store(); - } -} -if ( ! function_exists( 'woocommerce_page_title' ) ) { - function woocommerce_page_title( $echo = true ) { - wc_page_title( $echo ); - } -} -if ( ! function_exists( 'woocommerce_product_loop_start' ) ) { - function woocommerce_product_loop_start( $echo = true ) { - wc_product_loop_start( $echo ); - } -} -if ( ! function_exists( 'woocommerce_product_loop_end' ) ) { - function woocommerce_product_loop_end( $echo = true ) { - wc_product_loop_end( $echo ); - } -} -if ( ! function_exists( 'woocommerce_taxonomy_archive_description' ) ) { - function woocommerce_taxonomy_archive_description() { - wc_taxonomy_archive_description(); - } -} -if ( ! function_exists( 'woocommerce_product_archive_description' ) ) { - function woocommerce_product_archive_description() { - wc_product_archive_description(); - } -} -if ( ! function_exists( 'woocommerce_template_loop_add_to_cart' ) ) { - function woocommerce_template_loop_add_to_cart() { - wc_template_loop_add_to_cart(); - } -} -if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) { - function woocommerce_template_loop_product_thumbnail() { - wc_template_loop_product_thumbnail(); - } -} -if ( ! function_exists( 'woocommerce_template_loop_price' ) ) { - function woocommerce_template_loop_price() { - wc_template_loop_price(); - } -} -if ( ! function_exists( 'woocommerce_template_loop_rating' ) ) { - function woocommerce_template_loop_rating() { - wc_template_loop_rating(); - } -} -if ( ! function_exists( 'woocommerce_show_product_loop_sale_flash' ) ) { - function woocommerce_show_product_loop_sale_flash() { - wc_show_product_loop_sale_flash(); - } -} -if ( ! function_exists( 'woocommerce_reset_loop' ) ) { - function woocommerce_reset_loop() { - wc_reset_loop(); - } -} -if ( ! function_exists( 'woocommerce_get_product_schema' ) ) { - function woocommerce_get_product_schema() { - wc_get_product_schema(); - } -} -if ( ! function_exists( 'woocommerce_get_product_thumbnail' ) ) { - function woocommerce_get_product_thumbnail() { - wc_get_product_thumbnail(); - } -} -if ( ! function_exists( 'woocommerce_result_count' ) ) { - function woocommerce_result_count() { - wc_result_count(); - } -} -if ( ! function_exists( 'woocommerce_catalog_ordering' ) ) { - function woocommerce_catalog_ordering() { - wc_catalog_ordering(); - } -} -if ( ! function_exists( 'woocommerce_pagination' ) ) { - function woocommerce_pagination() { - wc_pagination(); - } -} -if ( ! function_exists( 'woocommerce_show_product_images' ) ) { - function woocommerce_show_product_images() { - wc_show_product_images(); - } -} -if ( ! function_exists( 'woocommerce_show_product_thumbnails' ) ) { - function woocommerce_show_product_thumbnails() { - wc_show_product_thumbnails(); - } -} -if ( ! function_exists( 'woocommerce_output_product_data_tabs' ) ) { - function woocommerce_output_product_data_tabs() { - wc_output_product_data_tabs(); - } -} -if ( ! function_exists( 'woocommerce_template_single_title' ) ) { - function woocommerce_template_single_title() { - wc_template_single_title(); - } -} -if ( ! function_exists( 'woocommerce_template_single_rating' ) ) { - function woocommerce_template_single_rating() { - wc_template_single_rating(); - } -} -if ( ! function_exists( 'woocommerce_template_single_price' ) ) { - function woocommerce_template_single_price() { - wc_template_single_price(); - } -} -if ( ! function_exists( 'woocommerce_template_single_excerpt' ) ) { - function woocommerce_template_single_excerpt() { - wc_template_single_excerpt(); - } -} -if ( ! function_exists( 'woocommerce_template_single_meta' ) ) { - function woocommerce_template_single_meta() { - wc_template_single_meta(); - } -} -if ( ! function_exists( 'woocommerce_template_single_sharing' ) ) { - function woocommerce_template_single_sharing() { - wc_template_single_sharing(); - } -} -if ( ! function_exists( 'woocommerce_show_product_sale_flash' ) ) { - function woocommerce_show_product_sale_flash() { - wc_show_product_sale_flash(); - } -} -if ( ! function_exists( 'woocommerce_template_single_add_to_cart' ) ) { - function woocommerce_template_single_add_to_cart() { - wc_template_single_add_to_cart(); - } -} -if ( ! function_exists( 'woocommerce_simple_add_to_cart' ) ) { - function woocommerce_simple_add_to_cart() { - wc_simple_add_to_cart(); - } -} -if ( ! function_exists( 'woocommerce_grouped_add_to_cart' ) ) { - function woocommerce_grouped_add_to_cart() { - wc_grouped_add_to_cart(); - } -} -if ( ! function_exists( 'woocommerce_variable_add_to_cart' ) ) { - function woocommerce_variable_add_to_cart() { - wc_variable_add_to_cart(); - } -} -if ( ! function_exists( 'woocommerce_external_add_to_cart' ) ) { - function woocommerce_external_add_to_cart() { - wc_external_add_to_cart(); - } -} -if ( ! function_exists( 'woocommerce_quantity_input' ) ) { - function woocommerce_quantity_input( $args = array() ) { - wc_quantity_input( $args ); - } -} -if ( ! function_exists( 'woocommerce_product_description_tab' ) ) { - function woocommerce_product_description_tab() { - wc_product_description_tab(); - } -} -if ( ! function_exists( 'woocommerce_product_additional_information_tab' ) ) { - function woocommerce_product_additional_information_tab() { - wc_product_additional_information_tab(); - } -} -if ( ! function_exists( 'woocommerce_product_reviews_tab' ) ) { - function woocommerce_product_reviews_tab() { - wc_product_reviews_tab(); - } -} -if ( ! function_exists( 'woocommerce_default_product_tabs' ) ) { - function woocommerce_default_product_tabs( $tabs = array() ) { - wc_default_product_tabs( $tabs ); - } -} -if ( ! function_exists( 'woocommerce_sort_product_tabs' ) ) { - function woocommerce_sort_product_tabs( $tabs = array() ) { - wc_sort_product_tabs( $tabs ); - } -} -if ( ! function_exists( 'woocommerce_comments' ) ) { - function woocommerce_comments( $comment, $args, $depth ) { - wc_comments( $comment, $args, $depth ); - } -} -if ( ! function_exists( 'woocommerce_output_related_products' ) ) { - function woocommerce_output_related_products() { - wc_output_related_products(); - } -} -if ( ! function_exists( 'woocommerce_related_products' ) ) { - function woocommerce_related_products( $args = array(), $columns = false, $orderby = false ) { - wc_related_products( $args, $columns, $orderby ); - } -} -if ( ! function_exists( 'woocommerce_upsell_display' ) ) { - function woocommerce_upsell_display( $posts_per_page = '-1', $columns = 2, $orderby = 'rand' ) { - wc_upsell_display( $posts_per_page, $columns, $orderby ); - } -} -if ( ! function_exists( 'woocommerce_shipping_calculator' ) ) { - function woocommerce_shipping_calculator() { - wc_shipping_calculator(); - } -} -if ( ! function_exists( 'woocommerce_cart_totals' ) ) { - function woocommerce_cart_totals() { - wc_cart_totals(); - } -} -if ( ! function_exists( 'woocommerce_cross_sell_display' ) ) { - function woocommerce_cross_sell_display( $posts_per_page = 2, $columns = 2, $orderby = 'rand' ) { - wc_cross_sell_display( $posts_per_page, $columns, $orderby ); - } -} -if ( ! function_exists( 'woocommerce_mini_cart' ) ) { - function woocommerce_mini_cart( $args = array() ) { - wc_mini_cart( $args ); - } -} -if ( ! function_exists( 'woocommerce_login_form' ) ) { - function woocommerce_login_form( $args = array() ) { - wc_login_form( $args ); - } -} -if ( ! function_exists( 'woocommerce_checkout_login_form' ) ) { - function woocommerce_checkout_login_form() { - wc_checkout_login_form(); - } -} -if ( ! function_exists( 'woocommerce_breadcrumb' ) ) { - function woocommerce_breadcrumb( $args = array() ) { - wc_breadcrumb( $args ); - } -} -if ( ! function_exists( 'woocommerce_order_review' ) ) { - function woocommerce_order_review() { - wc_order_review(); - } -} -if ( ! function_exists( 'woocommerce_checkout_coupon_form' ) ) { - function woocommerce_checkout_coupon_form() { - wc_checkout_coupon_form(); - } -} -if ( ! function_exists( 'woocommerce_products_will_display' ) ) { - function woocommerce_products_will_display() { - wc_products_will_display(); - } -} -if ( ! function_exists( 'woocommerce_product_subcategories' ) ) { - function woocommerce_product_subcategories( $args = array() ) { - wc_product_subcategories( $args ); - } -} -if ( ! function_exists( 'woocommerce_subcategory_thumbnail' ) ) { - function woocommerce_subcategory_thumbnail( $category ) { - wc_subcategory_thumbnail( $category ); - } -} -if ( ! function_exists( 'woocommerce_order_details_table' ) ) { - function woocommerce_order_details_table( $order_id ) { - wc_order_details_table( $order_id ); - } -} -if ( ! function_exists( 'woocommerce_order_again_button' ) ) { - function woocommerce_order_again_button( $order ) { - wc_order_again_button( $order ); - } -} -if ( ! function_exists( 'woocommerce_form_field' ) ) { - function woocommerce_form_field( $key, $args, $value = null ) { - wc_form_field( $key, $args, $value ); - } -} -if ( ! function_exists( 'woocommerce_products_rss_feed' ) ) { - function woocommerce_products_rss_feed() { - wc_products_rss_feed(); - } -} - /** * Product functions - soft deprecated */ diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index d4560f3c1be..35f9cdaca87 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -86,6 +86,39 @@ function wc_setup_product_data( $post ) { return $GLOBALS['product']; } +/** + * Products RSS Feed. + * + * @access public + * @return void + */ +function wc_products_rss_feed() { + // Product RSS + if ( is_post_type_archive( 'product' ) || is_singular( 'product' ) ) { + + $feed = get_post_type_archive_feed_link( 'product' ); + + echo ''; + + } elseif ( is_tax( 'product_cat' ) ) { + + $term = get_term_by('slug', esc_attr( get_query_var('product_cat') ), 'product_cat'); + + $feed = add_query_arg('product_cat', $term->slug, get_post_type_archive_feed_link( 'product' )); + + echo ''; + + } elseif ( is_tax( 'product_tag' ) ) { + + $term = get_term_by('slug', esc_attr( get_query_var('product_tag') ), 'product_tag'); + + $feed = add_query_arg('product_tag', $term->slug, get_post_type_archive_feed_link( 'product' )); + + echo ''; + + } +} + /** * Output generator tag to aid debugging. * @@ -132,6 +165,72 @@ function wc_body_class( $classes ) { return array_unique( $classes ); } +/** + * Adds extra post classes for products + * + * @since 2.1.0 + * @param array $classes + * @param string|array $class + * @param int $post_id + * @return array + */ +function wc_product_post_class( $classes, $class = '', $post_id = '' ) { + if ( ! $post_id || get_post_type( $post_id ) !== 'product' ) + return $classes; + + $product = get_product( $post_id ); + + if ( $product ) { + if ( $product->is_on_sale() ) { + $classes[] = 'sale'; + } + if ( $product->is_featured() ) { + $classes[] = 'featured'; + } + if ( $product->is_downloadable() ) { + $classes[] = 'downloadable'; + } + if ( $product->is_virtual() ) { + $classes[] = 'virtual'; + } + if ( $product->is_sold_individually() ) { + $classes[] = 'sold-individually'; + } + if ( $product->is_taxable() ) { + $classes[] = 'taxable'; + } + if ( $product->is_shipping_taxable() ) { + $classes[] = 'shipping-taxable'; + } + if ( $product->is_purchasable() ) { + $classes[] = 'purchasable'; + } + if ( isset( $product->product_type ) ) { + $classes[] = "product-type-" . $product->product_type; + } + + // add category slugs + $categories = wp_get_post_terms( $product->id, "product_cat" ); + if ( ! empty( $categories ) ) { + foreach ($categories as $key => $value) { + $classes[] = "product-cat-" . $value->slug; + } + } + + // add tag slugs + $tags = wp_get_post_terms( $product->id, "product_tag" ); + if ( ! empty( $tags ) ) { + foreach ($tags as $key => $value) { + $classes[] = "product-tag-" . $value->slug; + } + } + + $classes[] = $product->stock_status; + } + + return $classes; +} + /** Template pages ********************************************************/ if ( ! function_exists( 'woocommerce_content' ) ) { @@ -196,76 +295,7 @@ if ( ! function_exists( 'woocommerce_content' ) ) { /** Global ****************************************************************/ -if ( ! function_exists( 'wc_product_post_class' ) ) { - - /** - * Adds extra post classes for products - * - * @since 2.1.0 - * @param array $classes - * @param string|array $class - * @param int $post_id - * @return array - */ - function wc_product_post_class( $classes, $class = '', $post_id = '' ) { - if ( ! $post_id || get_post_type( $post_id ) !== 'product' ) - return $classes; - - $product = get_product( $post_id ); - - if ( $product ) { - if ( $product->is_on_sale() ) { - $classes[] = 'sale'; - } - if ( $product->is_featured() ) { - $classes[] = 'featured'; - } - if ( $product->is_downloadable() ) { - $classes[] = 'downloadable'; - } - if ( $product->is_virtual() ) { - $classes[] = 'virtual'; - } - if ( $product->is_sold_individually() ) { - $classes[] = 'sold-individually'; - } - if ( $product->is_taxable() ) { - $classes[] = 'taxable'; - } - if ( $product->is_shipping_taxable() ) { - $classes[] = 'shipping-taxable'; - } - if ( $product->is_purchasable() ) { - $classes[] = 'purchasable'; - } - if ( isset( $product->product_type ) ) { - $classes[] = "product-type-" . $product->product_type; - } - - // add category slugs - $categories = wp_get_post_terms( $product->id, "product_cat" ); - if ( ! empty( $categories ) ) { - foreach ($categories as $key => $value) { - $classes[] = "product-cat-" . $value->slug; - } - } - - // add tag slugs - $tags = wp_get_post_terms( $product->id, "product_tag" ); - if ( ! empty( $tags ) ) { - foreach ($tags as $key => $value) { - $classes[] = "product-tag-" . $value->slug; - } - } - - $classes[] = $product->stock_status; - } - - return $classes; - } -} - -if ( ! function_exists( 'wc_output_content_wrapper' ) ) { +if ( ! function_exists( 'woocommerce_output_content_wrapper' ) ) { /** * Output the start of the page wrapper. @@ -273,11 +303,11 @@ if ( ! function_exists( 'wc_output_content_wrapper' ) ) { * @access public * @return void */ - function wc_output_content_wrapper() { + function woocommerce_output_content_wrapper() { woocommerce_get_template( 'shop/wrapper-start.php' ); } } -if ( ! function_exists( 'wc_output_content_wrapper_end' ) ) { +if ( ! function_exists( 'woocommerce_output_content_wrapper_end' ) ) { /** * Output the end of the page wrapper. @@ -285,12 +315,12 @@ if ( ! function_exists( 'wc_output_content_wrapper_end' ) ) { * @access public * @return void */ - function wc_output_content_wrapper_end() { + function woocommerce_output_content_wrapper_end() { woocommerce_get_template( 'shop/wrapper-end.php' ); } } -if ( ! function_exists( 'wc_get_sidebar' ) ) { +if ( ! function_exists( 'woocommerce_get_sidebar' ) ) { /** * Get the shop sidebar template. @@ -298,12 +328,12 @@ if ( ! function_exists( 'wc_get_sidebar' ) ) { * @access public * @return void */ - function wc_get_sidebar() { + function woocommerce_get_sidebar() { woocommerce_get_template( 'shop/sidebar.php' ); } } -if ( ! function_exists( 'wc_demo_store' ) ) { +if ( ! function_exists( 'woocommerce_demo_store' ) ) { /** * Adds a demo store banner to the site if enabled @@ -311,7 +341,7 @@ if ( ! function_exists( 'wc_demo_store' ) ) { * @access public * @return void */ - function wc_demo_store() { + function woocommerce_demo_store() { if ( get_option( 'woocommerce_demo_store' ) == 'no' ) return; @@ -325,7 +355,7 @@ if ( ! function_exists( 'wc_demo_store' ) ) { /** Loop ******************************************************************/ -if ( ! function_exists( 'wc_page_title' ) ) { +if ( ! function_exists( 'woocommerce_page_title' ) ) { /** * woocommerce_page_title function. @@ -333,7 +363,7 @@ if ( ! function_exists( 'wc_page_title' ) ) { * @param boolean $echo * @return string */ - function wc_page_title( $echo = true ) { + function woocommerce_page_title( $echo = true ) { if ( is_search() ) { $page_title = sprintf( __( 'Search Results: “%s”', 'woocommerce' ), get_search_query() ); @@ -361,7 +391,7 @@ if ( ! function_exists( 'wc_page_title' ) ) { } } -if ( ! function_exists( 'wc_product_loop_start' ) ) { +if ( ! function_exists( 'woocommerce_product_loop_start' ) ) { /** * Output the start of a product loop. By default this is a UL @@ -369,7 +399,7 @@ if ( ! function_exists( 'wc_product_loop_start' ) ) { * @access public * @return void */ - function wc_product_loop_start( $echo = true ) { + function woocommerce_product_loop_start( $echo = true ) { ob_start(); woocommerce_get_template( 'loop/loop-start.php' ); if ( $echo ) @@ -378,7 +408,7 @@ if ( ! function_exists( 'wc_product_loop_start' ) ) { return ob_get_clean(); } } -if ( ! function_exists( 'wc_product_loop_end' ) ) { +if ( ! function_exists( 'woocommerce_product_loop_end' ) ) { /** * Output the end of a product loop. By default this is a UL @@ -386,7 +416,7 @@ if ( ! function_exists( 'wc_product_loop_end' ) ) { * @access public * @return void */ - function wc_product_loop_end( $echo = true ) { + function woocommerce_product_loop_end( $echo = true ) { ob_start(); woocommerce_get_template( 'loop/loop-end.php' ); @@ -397,7 +427,7 @@ if ( ! function_exists( 'wc_product_loop_end' ) ) { return ob_get_clean(); } } -if ( ! function_exists( 'wc_taxonomy_archive_description' ) ) { +if ( ! function_exists( 'woocommerce_taxonomy_archive_description' ) ) { /** * Show an archive description on taxonomy archives @@ -406,7 +436,7 @@ if ( ! function_exists( 'wc_taxonomy_archive_description' ) ) { * @subpackage Archives * @return void */ - function wc_taxonomy_archive_description() { + function woocommerce_taxonomy_archive_description() { if ( is_tax( array( 'product_cat', 'product_tag' ) ) && get_query_var( 'paged' ) == 0 ) { $description = apply_filters( 'the_content', term_description() ); if ( $description ) { @@ -415,7 +445,7 @@ if ( ! function_exists( 'wc_taxonomy_archive_description' ) ) { } } } -if ( ! function_exists( 'wc_product_archive_description' ) ) { +if ( ! function_exists( 'woocommerce_product_archive_description' ) ) { /** * Show a shop page description on product archives @@ -424,7 +454,7 @@ if ( ! function_exists( 'wc_product_archive_description' ) ) { * @subpackage Archives * @return void */ - function wc_product_archive_description() { + function woocommerce_product_archive_description() { if ( is_post_type_archive( 'product' ) && get_query_var( 'paged' ) == 0 ) { $shop_page = get_post( woocommerce_get_page_id( 'shop' ) ); if ( $shop_page ) { @@ -437,7 +467,7 @@ if ( ! function_exists( 'wc_product_archive_description' ) ) { } } -if ( ! function_exists( 'wc_template_loop_add_to_cart' ) ) { +if ( ! function_exists( 'woocommerce_template_loop_add_to_cart' ) ) { /** * Get the add to cart template for the loop. @@ -446,11 +476,11 @@ if ( ! function_exists( 'wc_template_loop_add_to_cart' ) ) { * @subpackage Loop * @return void */ - function wc_template_loop_add_to_cart() { + function woocommerce_template_loop_add_to_cart() { woocommerce_get_template( 'loop/add-to-cart.php' ); } } -if ( ! function_exists( 'wc_template_loop_product_thumbnail' ) ) { +if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) { /** * Get the product thumbnail for the loop. @@ -459,11 +489,11 @@ if ( ! function_exists( 'wc_template_loop_product_thumbnail' ) ) { * @subpackage Loop * @return void */ - function wc_template_loop_product_thumbnail() { + function woocommerce_template_loop_product_thumbnail() { echo woocommerce_get_product_thumbnail(); } } -if ( ! function_exists( 'wc_template_loop_price' ) ) { +if ( ! function_exists( 'woocommerce_template_loop_price' ) ) { /** * Get the product price for the loop. @@ -472,11 +502,11 @@ if ( ! function_exists( 'wc_template_loop_price' ) ) { * @subpackage Loop * @return void */ - function wc_template_loop_price() { + function woocommerce_template_loop_price() { woocommerce_get_template( 'loop/price.php' ); } } -if ( ! function_exists( 'wc_template_loop_rating' ) ) { +if ( ! function_exists( 'woocommerce_template_loop_rating' ) ) { /** * Display the average rating in the loop @@ -485,11 +515,11 @@ if ( ! function_exists( 'wc_template_loop_rating' ) ) { * @subpackage Loop * @return void */ - function wc_template_loop_rating() { + function woocommerce_template_loop_rating() { woocommerce_get_template( 'loop/rating.php' ); } } -if ( ! function_exists( 'wc_show_product_loop_sale_flash' ) ) { +if ( ! function_exists( 'woocommerce_show_product_loop_sale_flash' ) ) { /** * Get the sale flash for the loop. @@ -498,12 +528,12 @@ if ( ! function_exists( 'wc_show_product_loop_sale_flash' ) ) { * @subpackage Loop * @return void */ - function wc_show_product_loop_sale_flash() { + function woocommerce_show_product_loop_sale_flash() { woocommerce_get_template( 'loop/sale-flash.php' ); } } -if ( ! function_exists( 'wc_reset_loop' ) ) { +if ( ! function_exists( 'woocommerce_reset_loop' ) ) { /** * Reset the loop's index and columns when we're done outputting a product loop. @@ -512,20 +542,20 @@ if ( ! function_exists( 'wc_reset_loop' ) ) { * @subpackage Loop * @return void */ - function wc_reset_loop() { + function woocommerce_reset_loop() { global $woocommerce_loop; // Reset loop/columns globals when starting a new loop $woocommerce_loop['loop'] = $woocommerce_loop['column'] = ''; } } -if ( ! function_exists( 'wc_get_product_schema' ) ) { +if ( ! function_exists( 'woocommerce_get_product_schema' ) ) { /** * Get a products Schema * @return string */ - function wc_get_product_schema() { + function woocommerce_get_product_schema() { global $post, $product; $schema = "Product"; @@ -549,7 +579,7 @@ if ( ! function_exists( 'wc_get_product_schema' ) ) { } } -if ( ! function_exists( 'wc_get_product_thumbnail' ) ) { +if ( ! function_exists( 'woocommerce_get_product_thumbnail' ) ) { /** * Get the product thumbnail, or the placeholder if not set. @@ -561,7 +591,7 @@ if ( ! function_exists( 'wc_get_product_thumbnail' ) ) { * @param int $placeholder_height (default: 0) * @return string */ - function wc_get_product_thumbnail( $size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0 ) { + function woocommerce_get_product_thumbnail( $size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0 ) { global $post; if ( has_post_thumbnail() ) @@ -571,7 +601,7 @@ if ( ! function_exists( 'wc_get_product_thumbnail' ) ) { } } -if ( ! function_exists( 'wc_result_count' ) ) { +if ( ! function_exists( 'woocommerce_result_count' ) ) { /** * Output the result count text (Showing x - x of x results). @@ -580,12 +610,12 @@ if ( ! function_exists( 'wc_result_count' ) ) { * @subpackage Loop * @return void */ - function wc_result_count() { + function woocommerce_result_count() { woocommerce_get_template( 'loop/result-count.php' ); } } -if ( ! function_exists( 'wc_catalog_ordering' ) ) { +if ( ! function_exists( 'woocommerce_catalog_ordering' ) ) { /** * Output the product sorting options. @@ -594,14 +624,14 @@ if ( ! function_exists( 'wc_catalog_ordering' ) ) { * @subpackage Loop * @return void */ - function wc_catalog_ordering() { + function woocommerce_catalog_ordering() { $orderby = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) ); woocommerce_get_template( 'loop/orderby.php', array( 'orderby' => $orderby ) ); } } -if ( ! function_exists( 'wc_pagination' ) ) { +if ( ! function_exists( 'woocommerce_pagination' ) ) { /** * Output the pagination. @@ -610,14 +640,14 @@ if ( ! function_exists( 'wc_pagination' ) ) { * @subpackage Loop * @return void */ - function wc_pagination() { + function woocommerce_pagination() { woocommerce_get_template( 'loop/pagination.php' ); } } /** Single Product ********************************************************/ -if ( ! function_exists( 'wc_show_product_images' ) ) { +if ( ! function_exists( 'woocommerce_show_product_images' ) ) { /** * Output the product image before the single product summary. @@ -626,11 +656,11 @@ if ( ! function_exists( 'wc_show_product_images' ) ) { * @subpackage Product * @return void */ - function wc_show_product_images() { + function woocommerce_show_product_images() { woocommerce_get_template( 'single-product/product-image.php' ); } } -if ( ! function_exists( 'wc_show_product_thumbnails' ) ) { +if ( ! function_exists( 'woocommerce_show_product_thumbnails' ) ) { /** * Output the product thumbnails. @@ -639,11 +669,11 @@ if ( ! function_exists( 'wc_show_product_thumbnails' ) ) { * @subpackage Product * @return void */ - function wc_show_product_thumbnails() { + function woocommerce_show_product_thumbnails() { woocommerce_get_template( 'single-product/product-thumbnails.php' ); } } -if ( ! function_exists( 'wc_output_product_data_tabs' ) ) { +if ( ! function_exists( 'woocommerce_output_product_data_tabs' ) ) { /** * Output the product tabs. @@ -652,11 +682,11 @@ if ( ! function_exists( 'wc_output_product_data_tabs' ) ) { * @subpackage Product/Tabs * @return void */ - function wc_output_product_data_tabs() { + function woocommerce_output_product_data_tabs() { woocommerce_get_template( 'single-product/tabs/tabs.php' ); } } -if ( ! function_exists( 'wc_template_single_title' ) ) { +if ( ! function_exists( 'woocommerce_template_single_title' ) ) { /** * Output the product title. @@ -665,11 +695,11 @@ if ( ! function_exists( 'wc_template_single_title' ) ) { * @subpackage Product * @return void */ - function wc_template_single_title() { + function woocommerce_template_single_title() { woocommerce_get_template( 'single-product/title.php' ); } } -if ( ! function_exists( 'wc_template_single_rating' ) ) { +if ( ! function_exists( 'woocommerce_template_single_rating' ) ) { /** * Output the product rating. @@ -678,11 +708,11 @@ if ( ! function_exists( 'wc_template_single_rating' ) ) { * @subpackage Product * @return void */ - function wc_template_single_rating() { + function woocommerce_template_single_rating() { woocommerce_get_template( 'single-product/rating.php' ); } } -if ( ! function_exists( 'wc_template_single_price' ) ) { +if ( ! function_exists( 'woocommerce_template_single_price' ) ) { /** * Output the product price. @@ -691,11 +721,11 @@ if ( ! function_exists( 'wc_template_single_price' ) ) { * @subpackage Product * @return void */ - function wc_template_single_price() { + function woocommerce_template_single_price() { woocommerce_get_template( 'single-product/price.php' ); } } -if ( ! function_exists( 'wc_template_single_excerpt' ) ) { +if ( ! function_exists( 'woocommerce_template_single_excerpt' ) ) { /** * Output the product short description (excerpt). @@ -704,11 +734,11 @@ if ( ! function_exists( 'wc_template_single_excerpt' ) ) { * @subpackage Product * @return void */ - function wc_template_single_excerpt() { + function woocommerce_template_single_excerpt() { woocommerce_get_template( 'single-product/short-description.php' ); } } -if ( ! function_exists( 'wc_template_single_meta' ) ) { +if ( ! function_exists( 'woocommerce_template_single_meta' ) ) { /** * Output the product meta. @@ -717,11 +747,11 @@ if ( ! function_exists( 'wc_template_single_meta' ) ) { * @subpackage Product * @return void */ - function wc_template_single_meta() { + function woocommerce_template_single_meta() { woocommerce_get_template( 'single-product/meta.php' ); } } -if ( ! function_exists( 'wc_template_single_sharing' ) ) { +if ( ! function_exists( 'woocommerce_template_single_sharing' ) ) { /** * Output the product sharing. @@ -730,11 +760,11 @@ if ( ! function_exists( 'wc_template_single_sharing' ) ) { * @subpackage Product * @return void */ - function wc_template_single_sharing() { + function woocommerce_template_single_sharing() { woocommerce_get_template( 'single-product/share.php' ); } } -if ( ! function_exists( 'wc_show_product_sale_flash' ) ) { +if ( ! function_exists( 'woocommerce_show_product_sale_flash' ) ) { /** * Output the product sale flash. @@ -743,12 +773,12 @@ if ( ! function_exists( 'wc_show_product_sale_flash' ) ) { * @subpackage Product * @return void */ - function wc_show_product_sale_flash() { + function woocommerce_show_product_sale_flash() { woocommerce_get_template( 'single-product/sale-flash.php' ); } } -if ( ! function_exists( 'wc_template_single_add_to_cart' ) ) { +if ( ! function_exists( 'woocommerce_template_single_add_to_cart' ) ) { /** * Trigger the single product add to cart action. @@ -757,12 +787,12 @@ if ( ! function_exists( 'wc_template_single_add_to_cart' ) ) { * @subpackage Product * @return void */ - function wc_template_single_add_to_cart() { + function woocommerce_template_single_add_to_cart() { global $product; do_action( 'woocommerce_' . $product->product_type . '_add_to_cart' ); } } -if ( ! function_exists( 'wc_simple_add_to_cart' ) ) { +if ( ! function_exists( 'woocommerce_simple_add_to_cart' ) ) { /** * Output the simple product add to cart area. @@ -771,11 +801,11 @@ if ( ! function_exists( 'wc_simple_add_to_cart' ) ) { * @subpackage Product * @return void */ - function wc_simple_add_to_cart() { + function woocommerce_simple_add_to_cart() { woocommerce_get_template( 'single-product/add-to-cart/simple.php' ); } } -if ( ! function_exists( 'wc_grouped_add_to_cart' ) ) { +if ( ! function_exists( 'woocommerce_grouped_add_to_cart' ) ) { /** * Output the grouped product add to cart area. @@ -784,7 +814,7 @@ if ( ! function_exists( 'wc_grouped_add_to_cart' ) ) { * @subpackage Product * @return void */ - function wc_grouped_add_to_cart() { + function woocommerce_grouped_add_to_cart() { global $product; woocommerce_get_template( 'single-product/add-to-cart/grouped.php', array( @@ -794,7 +824,7 @@ if ( ! function_exists( 'wc_grouped_add_to_cart' ) ) { ) ); } } -if ( ! function_exists( 'wc_variable_add_to_cart' ) ) { +if ( ! function_exists( 'woocommerce_variable_add_to_cart' ) ) { /** * Output the variable product add to cart area. @@ -803,7 +833,7 @@ if ( ! function_exists( 'wc_variable_add_to_cart' ) ) { * @subpackage Product * @return void */ - function wc_variable_add_to_cart() { + function woocommerce_variable_add_to_cart() { global $product; // Enqueue variation scripts @@ -817,7 +847,7 @@ if ( ! function_exists( 'wc_variable_add_to_cart' ) ) { ) ); } } -if ( ! function_exists( 'wc_external_add_to_cart' ) ) { +if ( ! function_exists( 'woocommerce_external_add_to_cart' ) ) { /** * Output the external product add to cart area. @@ -826,7 +856,7 @@ if ( ! function_exists( 'wc_external_add_to_cart' ) ) { * @subpackage Product * @return void */ - function wc_external_add_to_cart() { + function woocommerce_external_add_to_cart() { global $product; if ( ! $product->get_product_url() ) @@ -839,7 +869,7 @@ if ( ! function_exists( 'wc_external_add_to_cart' ) ) { } } -if ( ! function_exists( 'wc_quantity_input' ) ) { +if ( ! function_exists( 'woocommerce_quantity_input' ) ) { /** * Output the quantity input for add to cart forms. @@ -848,7 +878,7 @@ if ( ! function_exists( 'wc_quantity_input' ) ) { * @subpackage Product * @return void */ - function wc_quantity_input( $args = array() ) { + function woocommerce_quantity_input( $args = array() ) { global $product; $defaults = array( @@ -865,7 +895,7 @@ if ( ! function_exists( 'wc_quantity_input' ) ) { } } -if ( ! function_exists( 'wc_product_description_tab' ) ) { +if ( ! function_exists( 'woocommerce_product_description_tab' ) ) { /** * Output the description tab content. @@ -874,11 +904,11 @@ if ( ! function_exists( 'wc_product_description_tab' ) ) { * @subpackage Product/Tabs * @return void */ - function wc_product_description_tab() { + function woocommerce_product_description_tab() { woocommerce_get_template( 'single-product/tabs/description.php' ); } } -if ( ! function_exists( 'wc_product_additional_information_tab' ) ) { +if ( ! function_exists( 'woocommerce_product_additional_information_tab' ) ) { /** * Output the attributes tab content. @@ -887,11 +917,11 @@ if ( ! function_exists( 'wc_product_additional_information_tab' ) ) { * @subpackage Product/Tabs * @return void */ - function wc_product_additional_information_tab() { + function woocommerce_product_additional_information_tab() { woocommerce_get_template( 'single-product/tabs/additional-information.php' ); } } -if ( ! function_exists( 'wc_product_reviews_tab' ) ) { +if ( ! function_exists( 'woocommerce_product_reviews_tab' ) ) { /** * Output the reviews tab content. @@ -900,12 +930,12 @@ if ( ! function_exists( 'wc_product_reviews_tab' ) ) { * @subpackage Product/Tabs * @return void */ - function wc_product_reviews_tab() { + function woocommerce_product_reviews_tab() { woocommerce_get_template( 'single-product/tabs/reviews.php' ); } } -if ( ! function_exists( 'wc_default_product_tabs' ) ) { +if ( ! function_exists( 'woocommerce_default_product_tabs' ) ) { /** * Add default product tabs to product pages. @@ -914,7 +944,7 @@ if ( ! function_exists( 'wc_default_product_tabs' ) ) { * @param mixed $tabs * @return void */ - function wc_default_product_tabs( $tabs = array() ) { + function woocommerce_default_product_tabs( $tabs = array() ) { global $product, $post; // Description tab - shows product content @@ -945,7 +975,7 @@ if ( ! function_exists( 'wc_default_product_tabs' ) ) { } } -if ( ! function_exists( 'wc_sort_product_tabs' ) ) { +if ( ! function_exists( 'woocommerce_sort_product_tabs' ) ) { /** * Sort tabs by priority @@ -954,11 +984,11 @@ if ( ! function_exists( 'wc_sort_product_tabs' ) ) { * @param mixed $tabs * @return void */ - function wc_sort_product_tabs( $tabs = array() ) { + function woocommerce_sort_product_tabs( $tabs = array() ) { // Make sure the $tabs parameter is an array if ( ! is_array( $tabs ) ) { - trigger_error( "Function wc_sort_product_tabs() expects an array as the first parameter. Defaulting to empty array." ); + trigger_error( "Function woocommerce_sort_product_tabs() expects an array as the first parameter. Defaulting to empty array." ); $tabs = array( ); } @@ -977,7 +1007,7 @@ if ( ! function_exists( 'wc_sort_product_tabs' ) ) { } } -if ( ! function_exists( 'wc_comments' ) ) { +if ( ! function_exists( 'woocommerce_comments' ) ) { /** * Output the Review comments template. @@ -986,13 +1016,13 @@ if ( ! function_exists( 'wc_comments' ) ) { * @subpackage Product * @return void */ - function wc_comments( $comment, $args, $depth ) { + function woocommerce_comments( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; woocommerce_get_template( 'single-product/review.php', array( 'comment' => $comment, 'args' => $args, 'depth' => $depth ) ); } } -if ( ! function_exists( 'wc_output_related_products' ) ) { +if ( ! function_exists( 'woocommerce_output_related_products' ) ) { /** * Output the related products. @@ -1001,7 +1031,7 @@ if ( ! function_exists( 'wc_output_related_products' ) ) { * @subpackage Product * @return void */ - function wc_output_related_products() { + function woocommerce_output_related_products() { $args = array( 'posts_per_page' => 2, @@ -1013,7 +1043,7 @@ if ( ! function_exists( 'wc_output_related_products' ) ) { } } -if ( ! function_exists( 'wc_related_products' ) ) { +if ( ! function_exists( 'woocommerce_related_products' ) ) { /** * Output the related products. @@ -1024,7 +1054,7 @@ if ( ! function_exists( 'wc_related_products' ) ) { * @param bool Order by argument for backwards compat * @return void */ - function wc_related_products( $args = array(), $columns = false, $orderby = false ) { + function woocommerce_related_products( $args = array(), $columns = false, $orderby = false ) { if ( ! is_array( $args ) ) { _deprecated_argument( __FUNCTION__, '2.1', __( 'Use $args argument as an array instead. Deprecated argument will be removed in WC 2.2.', 'woocommerce' ) ); @@ -1049,7 +1079,7 @@ if ( ! function_exists( 'wc_related_products' ) ) { } } -if ( ! function_exists( 'wc_upsell_display' ) ) { +if ( ! function_exists( 'woocommerce_upsell_display' ) ) { /** * Output product up sells. @@ -1060,7 +1090,7 @@ if ( ! function_exists( 'wc_upsell_display' ) ) { * @param string $orderby (default: 'rand') * @return void */ - function wc_upsell_display( $posts_per_page = '-1', $columns = 2, $orderby = 'rand' ) { + function woocommerce_upsell_display( $posts_per_page = '-1', $columns = 2, $orderby = 'rand' ) { woocommerce_get_template( 'single-product/up-sells.php', array( 'posts_per_page' => $posts_per_page, 'orderby' => apply_filters( 'woocommerce_upsells_orderby', $orderby ), @@ -1071,7 +1101,7 @@ if ( ! function_exists( 'wc_upsell_display' ) ) { /** Cart ******************************************************************/ -if ( ! function_exists( 'wc_shipping_calculator' ) ) { +if ( ! function_exists( 'woocommerce_shipping_calculator' ) ) { /** * Output the cart shipping calculator. @@ -1080,12 +1110,12 @@ if ( ! function_exists( 'wc_shipping_calculator' ) ) { * @subpackage Cart * @return void */ - function wc_shipping_calculator() { + function woocommerce_shipping_calculator() { woocommerce_get_template( 'cart/shipping-calculator.php' ); } } -if ( ! function_exists( 'wc_cart_totals' ) ) { +if ( ! function_exists( 'woocommerce_cart_totals' ) ) { /** * Output the cart totals. @@ -1094,7 +1124,7 @@ if ( ! function_exists( 'wc_cart_totals' ) ) { * @subpackage Cart * @return void */ - function wc_cart_totals() { + function woocommerce_cart_totals() { woocommerce_get_template( 'cart/cart-totals.php' ); } } @@ -1102,7 +1132,7 @@ if ( ! function_exists( 'wc_cart_totals' ) ) { /** * Get shipping methods */ -function wc_cart_totals_shipping_html() { +function woocommerce_cart_totals_shipping_html() { $packages = WC()->shipping->get_packages(); foreach ( $packages as $i => $package ) { @@ -1115,7 +1145,7 @@ function wc_cart_totals_shipping_html() { /** * Get the subtotal */ -function wc_cart_totals_subtotal_html() { +function woocommerce_cart_totals_subtotal_html() { echo WC()->cart->get_cart_subtotal(); } @@ -1123,7 +1153,7 @@ function wc_cart_totals_subtotal_html() { * Get a coupon value * @param string $code */ -function wc_cart_totals_coupon_html( $coupon ) { +function woocommerce_cart_totals_coupon_html( $coupon ) { if ( is_string( $coupon ) ) $coupon = new WC_Coupon( $coupon ); @@ -1141,7 +1171,7 @@ function wc_cart_totals_coupon_html( $coupon ) { /** * Get order total html including inc tax if needed */ -function wc_cart_totals_order_total_html() { +function woocommerce_cart_totals_order_total_html() { echo '' . WC()->cart->get_total() . ' '; // If prices are tax inclusive, show taxes here @@ -1164,7 +1194,7 @@ function wc_cart_totals_order_total_html() { * Get the fee value * @param object $fee */ -function wc_cart_totals_fee_html( $fee ) { +function woocommerce_cart_totals_fee_html( $fee ) { echo WC()->cart->tax_display_cart == 'excl' ? woocommerce_price( $fee->amount ) : woocommerce_price( $fee->amount + $fee->tax ); } @@ -1173,7 +1203,7 @@ function wc_cart_totals_fee_html( $fee ) { * @param object $method * @return string */ -function wc_cart_totals_shipping_method_label( $method ) { +function woocommerce_cart_totals_shipping_method_label( $method ) { $label = $method->label; if ( $method->cost > 0 ) { @@ -1195,7 +1225,7 @@ function wc_cart_totals_shipping_method_label( $method ) { return apply_filters( 'woocommerce_cart_shipping_method_full_label', $label, $method ); } -if ( ! function_exists( 'wc_cross_sell_display' ) ) { +if ( ! function_exists( 'woocommerce_cross_sell_display' ) ) { /** * Output the cart cross-sells. @@ -1204,7 +1234,7 @@ if ( ! function_exists( 'wc_cross_sell_display' ) ) { * @param integer $columns * @param string $orderby */ - function wc_cross_sell_display( $posts_per_page = 2, $columns = 2, $orderby = 'rand' ) { + function woocommerce_cross_sell_display( $posts_per_page = 2, $columns = 2, $orderby = 'rand' ) { woocommerce_get_template( 'cart/cross-sells.php', array( 'posts_per_page' => $posts_per_page, 'orderby' => $orderby, @@ -1215,7 +1245,7 @@ if ( ! function_exists( 'wc_cross_sell_display' ) ) { /** Mini-Cart *************************************************************/ -if ( ! function_exists( 'wc_mini_cart' ) ) { +if ( ! function_exists( 'woocommerce_mini_cart' ) ) { /** * Output the Mini-cart - used by cart widget @@ -1223,7 +1253,7 @@ if ( ! function_exists( 'wc_mini_cart' ) ) { * @access public * @return void */ - function wc_mini_cart( $args = array() ) { + function woocommerce_mini_cart( $args = array() ) { $defaults = array( 'list_class' => '' @@ -1237,7 +1267,7 @@ if ( ! function_exists( 'wc_mini_cart' ) ) { /** Login *****************************************************************/ -if ( ! function_exists( 'wc_login_form' ) ) { +if ( ! function_exists( 'woocommerce_login_form' ) ) { /** * Output the WooCommerce Login Form @@ -1246,7 +1276,7 @@ if ( ! function_exists( 'wc_login_form' ) ) { * @subpackage Forms * @return void */ - function wc_login_form( $args = array() ) { + function woocommerce_login_form( $args = array() ) { $defaults = array( 'message' => '', @@ -1260,7 +1290,7 @@ if ( ! function_exists( 'wc_login_form' ) ) { } } -if ( ! function_exists( 'wc_checkout_login_form' ) ) { +if ( ! function_exists( 'woocommerce_checkout_login_form' ) ) { /** * Output the WooCommerce Checkout Login Form @@ -1269,12 +1299,12 @@ if ( ! function_exists( 'wc_checkout_login_form' ) ) { * @subpackage Checkout * @return void */ - function wc_checkout_login_form() { + function woocommerce_checkout_login_form() { woocommerce_get_template( 'checkout/form-login.php', array( 'checkout' => WC()->checkout() ) ); } } -if ( ! function_exists( 'wc_breadcrumb' ) ) { +if ( ! function_exists( 'woocommerce_breadcrumb' ) ) { /** * Output the WooCommerce Breadcrumb @@ -1282,7 +1312,7 @@ if ( ! function_exists( 'wc_breadcrumb' ) ) { * @access public * @return void */ - function wc_breadcrumb( $args = array() ) { + function woocommerce_breadcrumb( $args = array() ) { $defaults = apply_filters( 'woocommerce_breadcrumb_defaults', array( 'delimiter' => ' / ', @@ -1299,7 +1329,7 @@ if ( ! function_exists( 'wc_breadcrumb' ) ) { } } -if ( ! function_exists( 'wc_order_review' ) ) { +if ( ! function_exists( 'woocommerce_order_review' ) ) { /** * Output the Order review table for the checkout. @@ -1308,12 +1338,12 @@ if ( ! function_exists( 'wc_order_review' ) ) { * @subpackage Checkout * @return void */ - function wc_order_review() { + function woocommerce_order_review() { woocommerce_get_template( 'checkout/review-order.php', array( 'checkout' => WC()->checkout() ) ); } } -if ( ! function_exists( 'wc_checkout_coupon_form' ) ) { +if ( ! function_exists( 'woocommerce_checkout_coupon_form' ) ) { /** * Output the Coupon form for the checkout. @@ -1322,12 +1352,12 @@ if ( ! function_exists( 'wc_checkout_coupon_form' ) ) { * @subpackage Checkout * @return void */ - function wc_checkout_coupon_form() { + function woocommerce_checkout_coupon_form() { woocommerce_get_template( 'checkout/form-coupon.php', array( 'checkout' => WC()->checkout() ) ); } } -if ( ! function_exists( 'wc_products_will_display' ) ) { +if ( ! function_exists( 'woocommerce_products_will_display' ) ) { /** * Check if we will be showing products or not (and not subcats only) @@ -1336,7 +1366,7 @@ if ( ! function_exists( 'wc_products_will_display' ) ) { * @subpackage Loop * @return void */ - function wc_products_will_display() { + function woocommerce_products_will_display() { global $wpdb; if ( ! is_product_category() && ! is_product_tag() && ! is_shop() && ! is_product_taxonomy() ) @@ -1386,7 +1416,7 @@ if ( ! function_exists( 'wc_products_will_display' ) ) { } } -if ( ! function_exists( 'wc_product_subcategories' ) ) { +if ( ! function_exists( 'woocommerce_product_subcategories' ) ) { /** * Display product sub categories as thumbnails. @@ -1395,7 +1425,7 @@ if ( ! function_exists( 'wc_product_subcategories' ) ) { * @subpackage Loop * @return void */ - function wc_product_subcategories( $args = array() ) { + function woocommerce_product_subcategories( $args = array() ) { global $wp_query; $defaults = array( @@ -1499,7 +1529,7 @@ if ( ! function_exists( 'wc_product_subcategories' ) ) { } } -if ( ! function_exists( 'wc_subcategory_thumbnail' ) ) { +if ( ! function_exists( 'woocommerce_subcategory_thumbnail' ) ) { /** * Show subcategory thumbnails. @@ -1509,7 +1539,7 @@ if ( ! function_exists( 'wc_subcategory_thumbnail' ) ) { * @subpackage Loop * @return void */ - function wc_subcategory_thumbnail( $category ) { + function woocommerce_subcategory_thumbnail( $category ) { $small_thumbnail_size = apply_filters( 'single_product_small_thumbnail_size', 'shop_catalog' ); $dimensions = wc_get_image_size( $small_thumbnail_size ); $thumbnail_id = get_woocommerce_term_meta( $category->term_id, 'thumbnail_id', true ); @@ -1526,7 +1556,7 @@ if ( ! function_exists( 'wc_subcategory_thumbnail' ) ) { } } -if ( ! function_exists( 'wc_order_details_table' ) ) { +if ( ! function_exists( 'woocommerce_order_details_table' ) ) { /** * Displays order details in a table. @@ -1536,7 +1566,7 @@ if ( ! function_exists( 'wc_order_details_table' ) ) { * @subpackage Orders * @return void */ - function wc_order_details_table( $order_id ) { + function woocommerce_order_details_table( $order_id ) { if ( ! $order_id ) return; woocommerce_get_template( 'order/order-details.php', array( @@ -1546,7 +1576,7 @@ if ( ! function_exists( 'wc_order_details_table' ) ) { } -if ( ! function_exists( 'wc_order_again_button' ) ) { +if ( ! function_exists( 'woocommerce_order_again_button' ) ) { /** * Display an 'order again' button on the view order page. @@ -1556,7 +1586,7 @@ if ( ! function_exists( 'wc_order_again_button' ) ) { * @subpackage Orders * @return void */ - function wc_order_again_button( $order ) { + function woocommerce_order_again_button( $order ) { if ( ! $order || $order->status != 'completed' ) return; @@ -1570,7 +1600,7 @@ if ( ! function_exists( 'wc_order_again_button' ) ) { /** Forms ****************************************************************/ -if ( ! function_exists( 'wc_form_field' ) ) { +if ( ! function_exists( 'woocommerce_form_field' ) ) { /** * Outputs a checkout/address form field. @@ -1582,7 +1612,7 @@ if ( ! function_exists( 'wc_form_field' ) ) { * @param string $value (default: null) * @return void */ - function wc_form_field( $key, $args, $value = null ) { + function woocommerce_form_field( $key, $args, $value = null ) { $defaults = array( 'type' => 'text', 'label' => '', @@ -1826,40 +1856,4 @@ if ( ! function_exists( 'get_product_search_form' ) ) { else return apply_filters( 'get_product_search_form', $form ); } -} - -if ( ! function_exists( 'wc_products_rss_feed' ) ) { - - /** - * Products RSS Feed. - * - * @access public - * @return void - */ - function wc_products_rss_feed() { - // Product RSS - if ( is_post_type_archive( 'product' ) || is_singular( 'product' ) ) { - - $feed = get_post_type_archive_feed_link( 'product' ); - - echo ''; - - } elseif ( is_tax( 'product_cat' ) ) { - - $term = get_term_by('slug', esc_attr( get_query_var('product_cat') ), 'product_cat'); - - $feed = add_query_arg('product_cat', $term->slug, get_post_type_archive_feed_link( 'product' )); - - echo ''; - - } elseif ( is_tax( 'product_tag' ) ) { - - $term = get_term_by('slug', esc_attr( get_query_var('product_tag') ), 'product_tag'); - - $feed = add_query_arg('product_tag', $term->slug, get_post_type_archive_feed_link( 'product' )); - - echo ''; - - } - } -} +} \ No newline at end of file diff --git a/includes/wc-template-hooks.php b/includes/wc-template-hooks.php index 2c60cba2dd8..e4b68d9e82f 100644 --- a/includes/wc-template-hooks.php +++ b/includes/wc-template-hooks.php @@ -13,9 +13,12 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly add_action( 'the_post', 'wc_setup_product_data' ); -add_action( 'template_redirect', 'woocommerce_template_redirect' ); +add_action( 'template_redirect', 'wc_template_redirect' ); add_filter( 'body_class', 'wc_body_class' ); add_filter( 'post_class', 'wc_product_post_class', 20, 3 ); +add_action( 'wp_head', 'wc_products_rss_feed' ); +add_action( 'wp_head', 'wc_generator_tag' ); +add_action( 'wp_footer', 'wc_print_js', 25 ); /** * Content Wrappers @@ -171,23 +174,12 @@ add_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 */ add_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); -/** - * Header - * - * @see woocommerce_products_rss_feed() - * @see wc_generator_tag() - */ -add_action( 'wp_head', 'woocommerce_products_rss_feed' ); -add_action( 'wp_head', 'wc_generator_tag' ); - /** * Footer * * @see woocommerce_demo_store() - * @see wc_print_js() */ add_action( 'wp_footer', 'woocommerce_demo_store' ); -add_action( 'wp_footer', 'wc_print_js', 25 ); /** * Order details