| 1 |
<?php |
| 2 |
/** |
| 3 |
* Hooks. |
| 4 |
*/ |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; |
| 8 |
} |
| 9 |
|
| 10 |
add_action( 'wp', 'storeengine_init_global_product_early' ); |
| 11 |
|
| 12 |
/** |
| 13 |
* Pre page load redirects. |
| 14 |
*/ |
| 15 |
add_action( 'template_redirect', 'storeengine_template_redirect' ); |
| 16 |
|
| 17 |
/** |
| 18 |
* Admin bar visibility. |
| 19 |
*/ |
| 20 |
add_filter( 'show_admin_bar', 'storeengine_disable_admin_bar', 10, 1 ); // phpcs:ignore WordPress.VIP.AdminBarRemoval.RemovalDetected |
| 21 |
|
| 22 |
/** |
| 23 |
* Page Template |
| 24 |
*/ |
| 25 |
add_filter( 'page_template', 'storeengine_redirect_canvas_page_template' ); |
| 26 |
|
| 27 |
/** |
| 28 |
* Archive Course Page |
| 29 |
*/ |
| 30 |
add_action( 'storeengine/templates/archive_product_content', 'storeengine_global_products' ); |
| 31 |
add_action( 'storeengine/templates/no_product_found', 'storeengine_no_products' ); |
| 32 |
|
| 33 |
// Product Single |
| 34 |
add_action( 'storeengine/templates/single_product_content', 'storeengine_single_view_cart' ); |
| 35 |
add_action( 'storeengine/templates/single_product_content', 'storeengine_single_product_header' ); |
| 36 |
add_action( 'storeengine/templates/single-product/header_right_content', 'storeengine_product_bundle_info' ); |
| 37 |
add_action( 'storeengine/templates/single-product/header_right_content', 'storeengine_single_product_add_to_cart' ); |
| 38 |
add_action( 'storeengine/templates/single_product_content', 'storeengine_single_product_description' ); |
| 39 |
add_action( 'storeengine/templates/single_product_content', 'storeengine_single_product_faq', 15 ); |
| 40 |
add_action( 'storeengine/templates/single_product_content', 'storeengine_single_product_review_and_comments' ); |
| 41 |
add_action( 'storeengine/templates/single_product_feedback', 'storeengine_single_product_feedback' ); |
| 42 |
add_action( 'storeengine/templates/single_view_cart_button', 'storeengine_single_view_cart_button' ); |
| 43 |
add_action( 'storeengine/templates/single_filter', 'storeengine_single_filter' ); |
| 44 |
|
| 45 |
// Sidebar Widget |
| 46 |
add_action( 'storeengine/templates/single_product_sidebar_widgets', 'storeengine_price' ); |
| 47 |
add_action( 'storeengine/templates/single_product_sidebar_widgets', 'storeengine_add_to_cart_form' ); |
| 48 |
|
| 49 |
add_action( 'storeengine/templates/single_product_sidebar_widgets', 'storeengine_single_categories' ); |
| 50 |
add_action( 'storeengine/templates/single_product_sidebar_widgets', 'storeengine_single_tag' ); |
| 51 |
|
| 52 |
// Archive Header |
| 53 |
add_action( 'storeengine/templates/archive_product_header', 'storeengine_archive_product_header' ); |
| 54 |
|
| 55 |
// Archive Footer |
| 56 |
add_action( 'storeengine/templates/after_product_loop', 'storeengine_product_pagination' ); |
| 57 |
|
| 58 |
// Archive sidebar |
| 59 |
add_action( 'storeengine/templates/archive_product_sidebar_content', 'storeengine_archive_header_filter_widget' ); |
| 60 |
add_action( 'storeengine/templates/archive_product_sidebar', 'storeengine_archive_product_sidebar' ); |
| 61 |
|
| 62 |
// Archive Filter |
| 63 |
add_action( 'storeengine/templates/archive_header_filter', 'storeengine_archive_header_filter' ); |
| 64 |
|
| 65 |
/** |
| 66 |
* Product Loop |
| 67 |
*/ |
| 68 |
add_action( 'the_post', 'storeengine_initialize_product_data', 15 ); |
| 69 |
add_action( 'storeengine/templates/product_loop_header', 'storeengine_product_loop_header' ); |
| 70 |
add_action( 'storeengine/templates/after_product_loop_header_inner', 'storeengine_loop_card_enhancements' ); |
| 71 |
add_action( 'storeengine/templates/product_loop_content', 'storeengine_product_loop_content', 11 ); |
| 72 |
add_action( 'storeengine/templates/product_loop_footer', 'storeengine_product_loop_footer', 11 ); |
| 73 |
add_action( 'storeengine/templates/product_loop_footer_content', 'storeengine_product_loop_add_to_cart' ); |
| 74 |
|
| 75 |
/** |
| 76 |
* Checkout page |
| 77 |
*/ |
| 78 |
add_action( 'storeengine_checkout_payment', 'storeengine_checkout_payment_method' ); |
| 79 |
add_action( 'storeengine/templates/storeengine_checkout_total', 'storeengine_checkout_total' ); |
| 80 |
// fields |
| 81 |
add_action( 'storeengine/templates/checkout_form_fields', 'storeengine_checkout_form_field_user_info' ); |
| 82 |
add_action( 'storeengine/templates/checkout_form_fields', 'storeengine_checkout_form_field_shipping_address' ); |
| 83 |
add_action( 'storeengine/templates/checkout_form_fields', 'storeengine_checkout_form_field_billing_address' ); |
| 84 |
add_action( 'storeengine/templates/checkout_form_fields', 'storeengine_checkout_order_details' ); |
| 85 |
add_action( 'storeengine/templates/checkout_form_fields', 'storeengine_checkout_payment_method' ); |
| 86 |
|
| 87 |
/** |
| 88 |
* Frontend Dashboard |
| 89 |
*/ |
| 90 |
add_action( 'storeengine/frontend/dashboard_content', 'storeengine_frontend_dashboard_content_topbar' ); |
| 91 |
|
| 92 |
add_action( 'storeengine/templates/frontend-dashboard/topbar/breadcrumbs', 'storeengine_frontend_dashboard_breadcrumbs_order_title', 10, 2 ); |
| 93 |
add_action( 'storeengine/templates/frontend-dashboard/topbar/breadcrumbs', 'storeengine_frontend_dashboard_breadcrumbs_plan_title', 10, 2 ); |
| 94 |
|
| 95 |
// Shared page-header: per-endpoint description + primary action rendered in the |
| 96 |
// topbar, so pages no longer hand-roll their own title/description/action. |
| 97 |
add_filter( 'storeengine/frontend-dashboard/page_description', 'storeengine_frontend_dashboard_page_description', 10, 3 ); |
| 98 |
add_action( 'storeengine/templates/frontend-dashboard/topbar/right_content', 'storeengine_frontend_dashboard_topbar_actions', 10, 2 ); |
| 99 |
|
| 100 |
add_action( 'storeengine/frontend/dashboard_content', 'storeengine_frontend_dashboard_content' ); |
| 101 |
add_action( 'storeengine/frontend/dashboard_menu', 'storeengine_frontend_dashboard_menu' ); |
| 102 |
|
| 103 |
add_action( 'storeengine/dashboard/dashboard_content', 'storeengine_dashboard_orders', 30 ); |
| 104 |
add_action( 'storeengine/frontend/dashboard_orders_endpoint', 'storeengine_frontend_dashboard_orders_endpoint_content' ); |
| 105 |
|
| 106 |
add_action( 'storeengine/frontend/dashboard_downloads_endpoint', 'storeengine_frontend_dashboard_downloads_content' ); |
| 107 |
add_action( 'storeengine/frontend/dashboard_reviews_endpoint', 'storeengine_frontend_dashboard_reviews_content' ); |
| 108 |
add_action( 'storeengine/frontend/dashboard_edit-address_endpoint', 'storeengine_frontend_dashboard_edit_address_content' ); |
| 109 |
|
| 110 |
add_action( 'storeengine/frontend/dashboard_payment-methods_endpoint', 'storeengine_frontend_dashboard_payment_methods_content' ); |
| 111 |
add_action( 'storeengine/frontend/dashboard_add-payment-method_endpoint', 'storeengine_frontend_dashboard_add_payment_method_content' ); |
| 112 |
|
| 113 |
add_action( 'storeengine/frontend/dashboard_payment-settings_endpoint', 'storeengine_frontend_dashboard_payment_settings_content' ); |
| 114 |
add_action( 'storeengine/frontend/dashboard_edit-account_endpoint', 'storeengine_frontend_dashboard_edit_account_content' ); |
| 115 |
add_action( 'storeengine/frontend/dashboard_forgot-password_endpoint', 'storeengine_frontend_dashboard_forgot_password_content' ); |
| 116 |
add_action( 'storeengine/frontend/dashboard_register_endpoint', 'storeengine_frontend_dashboard_register_content' ); |
| 117 |
|
| 118 |
// Note: we intentionally do NOT filter `lostpassword_url` or `register_url` |
| 119 |
// here. Those return WP core's wp-login.php URLs and many other places |
| 120 |
// (admin bar, plugins, mu-plugins) rely on that. Our StoreEngine login |
| 121 |
// template links to the in-dashboard endpoints directly — see |
| 122 |
// templates/shortcode/login.php — so customers who flow through our |
| 123 |
// branded sign-in screen get the branded reset/register journey, while |
| 124 |
// anyone bypassing it to wp-login.php still gets WP's default behavior. |
| 125 |
|
| 126 |
/** |
| 127 |
* Review |
| 128 |
*/ |
| 129 |
add_action( 'storeengine/templates/review_thumbnail', 'storeengine_review_display_gravatar' ); |
| 130 |
add_action( 'storeengine/templates/review_display_rating', 'storeengine_review_display_rating' ); |
| 131 |
add_action( 'storeengine/templates/review_meta', 'storeengine_review_display_meta' ); |
| 132 |
add_action( 'storeengine/templates/review_comment_text', 'storeengine_review_display_comment_text' ); |
| 133 |
add_action( 'storeengine/templates/review_after_comment_text', 'storeengine_review_display_media' ); |
| 134 |
|
| 135 |
add_action( 'storeengine/templates/dashboard_downloads_pagination', 'storeengine_dashboard_downloads_pagination' ); |
| 136 |
|
| 137 |
/** |
| 138 |
* Upsell & crosssell |
| 139 |
*/ |
| 140 |
add_action( 'storeengine/templates/after_main_content', 'storeengine_render_upsell_items' ); |
| 141 |
add_action( 'storeengine/templates/after_cart_list_table', 'storeengine_render_crosssell_items' ); |
| 142 |
|
| 143 |
/** |
| 144 |
* Like and Dislike |
| 145 |
*/ |
| 146 |
// @TODO implement like-dislike. |
| 147 |
// hook: storeengine/templates/like_dislike, cb: storeengine_single_like_dislike |
| 148 |
// maybe use hook: storeengine/templates/review_after_comment_text |
| 149 |
|
| 150 |
/** |
| 151 |
* Direct checkout with product & price id |
| 152 |
*/ |
| 153 |
add_action( 'template_redirect', 'storeengine_direct_checkout_url_params', 9 ); |
| 154 |
|