From d9c10aae620470e13da54e117fa33b7fa338d206 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 3 Mar 2014 13:37:45 +0000 Subject: [PATCH] Later hook for template redirect and the_post Closes #4984 --- includes/wc-template-functions.php | 2 ++ includes/wc-template-hooks.php | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index 8e728d1ed76..4ca5a574529 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -65,6 +65,7 @@ function wc_template_redirect() { WC()->shipping(); } } +add_action( 'template_redirect', 'wc_template_redirect' ); /** * When the_post is called, put product data into a global. @@ -85,6 +86,7 @@ function wc_setup_product_data( $post ) { return $GLOBALS['product']; } +add_action( 'the_post', 'wc_setup_product_data' ); /** * Products RSS Feed. diff --git a/includes/wc-template-hooks.php b/includes/wc-template-hooks.php index e4b68d9e82f..a883a48b42e 100644 --- a/includes/wc-template-hooks.php +++ b/includes/wc-template-hooks.php @@ -12,13 +12,17 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly -add_action( 'the_post', 'wc_setup_product_data' ); -add_action( 'template_redirect', 'wc_template_redirect' ); add_filter( 'body_class', 'wc_body_class' ); add_filter( 'post_class', 'wc_product_post_class', 20, 3 ); + +/** + * WP Header + * + * @see wc_products_rss_feed() + * @see wc_generator_tag() + */ 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 @@ -177,8 +181,10 @@ add_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); /** * Footer * + * @see wc_print_js() * @see woocommerce_demo_store() */ +add_action( 'wp_footer', 'wc_print_js', 25 ); add_action( 'wp_footer', 'woocommerce_demo_store' ); /**