Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 164 lines (126 sloc) 7.393 kb
0425a68 @mikejolley WooCommerce conversion and update
mikejolley authored
1 <?php
2 /**
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
3 * WooCommerce Hooks
0425a68 @mikejolley WooCommerce conversion and update
mikejolley authored
4 *
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
5 * Action/filter hooks used for WooCommerce functions/templates
0425a68 @mikejolley WooCommerce conversion and update
mikejolley authored
6 *
7 * @package WooCommerce
8 * @category Core
9 * @author WooThemes
10 */
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
11 global $woocommerce;
12
13 /** Template Hooks ********************************************************/
0425a68 @mikejolley WooCommerce conversion and update
mikejolley authored
14
3e89e19 @mikejolley hooks
mikejolley authored
15 if ( !is_admin() || defined('DOING_AJAX') ) {
0425a68 @mikejolley WooCommerce conversion and update
mikejolley authored
16
3e89e19 @mikejolley hooks
mikejolley authored
17 /* Content Wrappers */
18 add_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
19 add_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
20
21 /* Sale flashes */
22 add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10);
23 add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10);
24
25 /* Breadcrumbs */
26 add_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
27
28 /* Sidebar */
29 add_action( 'get_sidebar', 'woocommerce_prevent_sidebar_cache' );
30 add_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
31
32 /* Products Loop */
1596dd1 @mikejolley Messages Closes #566.
mikejolley authored
33 add_action( 'woocommerce_before_shop_loop', 'woocommerce_show_messages', 10 );
3e89e19 @mikejolley hooks
mikejolley authored
34 add_action( 'woocommerce_before_shop_loop_products', 'woocommerce_product_subcategories' );
35 add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);
36 add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
37 add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10);
38
39 /* Subcategories */
40 add_action( 'woocommerce_before_subcategory_title', 'woocommerce_subcategory_thumbnail', 10);
41
42 /* Before Single Products */
1596dd1 @mikejolley Messages Closes #566.
mikejolley authored
43 add_action( 'woocommerce_before_single_product', 'woocommerce_show_messages', 10 );
3e89e19 @mikejolley hooks
mikejolley authored
44
45 /* Before Single Products Summary Div */
46 add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20);
47 add_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );
48
49 /* After Single Products Summary Div */
50 add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10);
51 add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20);
52
53 /* Product Summary Box */
c6149e2 @jameskoster single product title template / hook
jameskoster authored
54 add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5);
3e89e19 @mikejolley hooks
mikejolley authored
55 add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10);
56 add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20);
57 add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40);
58 add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50);
59
60 /* After Single Products */
61 add_action('woocommerce_after_single_product', 'woocommerce_upsell_display');
62
63 /* Product Add to cart */
64 add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30);
65 add_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
66 add_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );
67 add_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 );
68 add_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 );
69
70 /* Pagination in loop-shop */
71 add_action( 'woocommerce_pagination', 'woocommerce_pagination', 10 );
72 add_action( 'woocommerce_pagination', 'woocommerce_catalog_ordering', 20 );
73
74 /* Product page tabs */
75 add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 );
76 add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 );
77 add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 );
78
79 add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 );
80 add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_attributes_panel', 20 );
81 add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30 );
82
83 /* Checkout */
84 add_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_login_form', 10 );
85 add_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
86 add_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );
87
88 /* Cart */
89 add_action('woocommerce_cart_collaterals', 'woocommerce_cross_sell_display');
90
91 /* Footer */
92 add_action( 'wp_footer', 'woocommerce_demo_store' );
93
94 /* Order details */
95 add_action( 'woocommerce_view_order', 'woocommerce_order_details_table', 10 );
96 add_action( 'woocommerce_thankyou', 'woocommerce_order_details_table', 10 );
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
97
3e89e19 @mikejolley hooks
mikejolley authored
98 }
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
99
100 /** Store Event Hooks *****************************************************/
101
102 /* Shop Page Handling and Support */
a2d51aa @mikejolley Github sabotages files -.-
mikejolley authored
103 add_action( 'template_redirect', 'woocommerce_redirects' );
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
104 add_filter( 'wp_nav_menu_objects', 'woocommerce_nav_menu_item_classes', 2, 20 );
105 add_action( 'wp', 'woocommerce_front_page_archive_paging_fix', 1 );
576ec9e @mikejolley Front page look fixes
mikejolley authored
106 add_action( 'woocommerce_before_shop_loop', 'woocommerce_front_page_archive', 1 );
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
107 add_filter( 'wp_list_pages', 'woocommerce_list_pages' );
108
109 /* Logout link */
110 add_filter( 'wp_nav_menu_items', 'woocommerce_nav_menu_items', 10, 2 );
111
112 /* Clear the cart */
554d134 @mikejolley Logout fix
mikejolley authored
113 if (get_option('woocommerce_clear_cart_on_logout')=='yes') add_action( 'wp_logout', 'woocommerce_empty_cart' );
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
114 add_action( 'wp', 'woocommerce_clear_cart_after_payment' );
115
cdbcda7 @mikejolley Disable admin bar for customers. Closes #772.
mikejolley authored
116 /* Disable admin bar */
7109290 @mikejolley Admin bar hidden for customers only when locked down. #824
mikejolley authored
117 add_action( 'init', 'woocommerce_disable_admin_bar' );
cdbcda7 @mikejolley Disable admin bar for customers. Closes #772.
mikejolley authored
118
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
119 /* Catalog sorting/ordering */
120 add_action( 'init', 'woocommerce_update_catalog_ordering' );
121
122 /* Cart Actions */
123 add_action( 'init', 'woocommerce_update_cart_action' );
124 add_action( 'init', 'woocommerce_add_to_cart_action' );
fa84b87 @mikejolley Persistent cart
mikejolley authored
125 add_action( 'wp_login', 'woocommerce_load_persistent_cart', 1, 2);
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
126
a2d51aa @mikejolley Github sabotages files -.-
mikejolley authored
127 /* Checkout Actions */
5678286 @mikejolley tweaks
mikejolley authored
128 add_action( 'init', 'woocommerce_checkout_action', 10 );
129 add_action( 'init', 'woocommerce_pay_action', 10 );
a2d51aa @mikejolley Github sabotages files -.-
mikejolley authored
130
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
131 /* Login and Registration */
132 add_action( 'init', 'woocommerce_process_login' );
c4625ad @mikejolley Coupon on checkout. Closes #379.
mikejolley authored
133 add_action( 'init', 'woocommerce_process_coupon_form' );
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
134 add_action( 'init', 'woocommerce_process_registration' );
135
136 /* Product Downloads */
137 add_action('init', 'woocommerce_download_product');
138
139 /* Analytics */
140 add_action( 'wp_footer', 'woocommerce_google_tracking' );
141 add_action( 'woocommerce_thankyou', 'woocommerce_ecommerce_tracking' );
3984282 @mikejolley Slight piwiki tracking change
mikejolley authored
142 add_action( 'woocommerce_thankyou', 'woocommerce_ecommerce_tracking_piwik' );
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
143
144 /* RSS Feeds */
145 add_action( 'wp_head', 'woocommerce_products_rss_feed' );
146
147 /* Order actions */
148 add_action( 'init', 'woocommerce_cancel_order' );
0b53bc0 @GeertDD Started building the possibility for a customer to place a previous orde...
GeertDD authored
149 add_action( 'init', 'woocommerce_order_again' );
033735b @mikejolley New structure + started moving template code to files
mikejolley authored
150 add_action( 'woocommerce_new_order', 'woocommerce_increase_coupon_counts' );
151
152 /* Star Ratings */
153 add_action( 'comment_post', 'woocommerce_add_comment_rating', 1 );
154 add_filter( 'preprocess_comment', 'woocommerce_check_comment_rating', 0 );
c21b70e @mikejolley Hooks for short description - avoid the_content
mikejolley authored
155
156 /* Text filters */
157 add_filter( 'woocommerce_short_description', 'wptexturize' );
158 add_filter( 'woocommerce_short_description', 'convert_smilies' );
159 add_filter( 'woocommerce_short_description', 'convert_chars' );
160 add_filter( 'woocommerce_short_description', 'wpautop' );
161 add_filter( 'woocommerce_short_description', 'shortcode_unautop' );
162 add_filter( 'woocommerce_short_description', 'prepend_attachment' );
586a49b @mikejolley filter tweaks
mikejolley authored
163 add_filter( 'woocommerce_short_description', 'do_shortcode', 11 ); // AFTER wpautop()
Something went wrong with that request. Please try again.