Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_filter('wc_get_template','wholesaler_template'), 10, 5);
- add_filter( 'wc_get_template_part', 'wholesaler_template_parts'), 10, 3);
- public function wholesaler_template($located, $template_name, $args, $template_path, $default_path) {
- global $woocommerce;
- $newpath = plugin_dir_path( __FILE__ ) . '/woocommerce/' . $template_name;
- return file_exists( $newpath ) ? $newpath : $located;
- }
- public function wholesaler_template_parts( $template, $slug, $name )
- {
- $plugin_path = plugin_dir_path( __FILE__ ) . '/woocommerce/';
- if ( $name ) {
- $newpath = $plugin_path . "{$slug}-{$name}.php";
- } else {
- $newpath = $plugin_path . "{$slug}.php";
- }
- return file_exists( $newpath ) ? $newpath : $template;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement