function include_theme_conf() { locate_template(array('inc/widgets.php'), true, true); locate_template(array('inc/post_types_functions.php'), true, true); locate_template(array('inc/ajax_operations.php'), true, true); locate_template(array('inc/rewrites.php'), true, true); }
/** * Locate the file in the "cache" folder, first in child theme and then in * parent theme. * * @param string $fname * @param mixed $content * @return bool * @since 1.0.0 */ public function locate_file($fname) { $folder_name = str_replace(get_stylesheet_directory_uri() . '/', '', YIT_CACHE_URL); $cache_dir = locate_template($folder_name, false); $file = $cache_dir . '/' . $fname; return $file; }
function nimbus_cotizador($atts, $content) { extract($atts); set_query_var('success', $action); $template = locate_template("/templates/quote.php"); load_template($template); }
/** * Replaces the page_template with the one specified in kohana_page_template * if this is a kohana request. * @param string $template * @return string */ function kohana_page_template_filter($template) { if (is_kohana_request() && get_option('kohana_page_template')) { return locate_template(array(get_option('kohana_page_template'))); } return $template; }
function presscore_load_meta_boxes() { $metaboxes = array('metaboxes', 'metaboxes-blog', 'metaboxes-portfolio', 'metaboxes-testimonials', 'metaboxes-team', 'metaboxes-logos', 'metaboxes-albums', 'metaboxes-slideshow', 'metaboxes-benefits', 'metaboxes-microsite'); foreach ($metaboxes as $metabox) { include_once locate_template("inc/admin/meta-boxes/{$metabox}.php"); } }
/** * Get template part (for templates in loops). * * @param mixed $slug * @param string $name (default: '') * @return void */ function get_job_manager_template_part($slug, $name = '', $template_path = '', $default_path = '') { if (!$template_path) { $template_path = 'job_manager'; } if (!$default_path) { $default_path = JOB_MANAGER_PLUGIN_DIR . '/templates/'; } $template = ''; // Look in yourtheme/slug-name.php and yourtheme/job_manager/slug-name.php if ($name) { $template = locate_template(array("{$slug}-{$name}.php", "{$template_path}/{$slug}-{$name}.php")); } // Get default slug-name.php if (!$template && $name && file_exists($default_path . "{$slug}-{$name}.php")) { $template = $default_path . "{$slug}-{$name}.php"; } // If template file doesn't exist, look in yourtheme/slug.php and yourtheme/job_manager/slug.php if (!$template) { $template = locate_template(array("{$slug}.php", "{$template_path}/{$slug}.php")); } if ($template) { load_template($template, false); } }
function form($instance) { $instance = wp_parse_args((array) $instance, array('sortby' => 'menu_order', 'title' => '', 'exclude' => '')); $title = esc_attr($instance['title']); $exclude = esc_attr($instance['exclude']); include locate_template('templates/widgets/conf/subpages.php'); }
public function showSlider($id = false) { if ($id === false) { if ($this->component == 'vegas') { $id = 'vegas'; } else { $id = 'slides'; } } if ($this->checkExistData()) { $data = $this->data; } else { if ($this->component == 'vegas') { $data[] = get_stylesheet_directory_uri() . '/assets/images/mauritius.jpg'; } else { $row['id'] = '-1'; $row['title'] = __('Posts no found', 'sage'); $row['content'] = ''; $row['excerpt'] = ''; $row['url'] = '#'; $row['image'] = get_stylesheet_directory_uri() . '/assets/images/mauritius.jpg'; $data[] = $row; } } if ($this->component == 'vegas') { $message = $this->message; $overlay = get_stylesheet_directory_uri() . '/bower_components/vegas/dist/overlays/07.png'; include locate_template('templates/partials/slider/vegas.php'); } else { include locate_template('templates/partials/slider/superslides.php'); } }
/** * @param array $args * @param array $instance */ function widget($args, $instance) { if (empty($instance['template'])) { return; } if (is_admin()) { return; } echo $args['before_widget']; $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); if (!empty($instance['title'])) { echo $args['before_title'] . $instance['title'] . $args['after_title']; } if (strpos('/' . $instance['template'], '/content') !== false) { while (have_posts()) { the_post(); locate_template($instance['template'], true, false); } } else { locate_template($instance['template'], true, false); } echo $args['after_widget']; // Reset everything rewind_posts(); wp_reset_postdata(); }
/** * Load a template. * * Handles template usage so that we can use our own templates instead of the themes. * * Templates are in the 'templates' folder. woocommerce looks for theme * overrides in /theme/woocommerce/ by default * * For beginners, it also looks for a woocommerce.php template first. If the user adds * this to the theme (containing a woocommerce() inside) this will be used for all * woocommerce templates. * * @param mixed $template * @return string */ public function template_loader($template) { $find = array('woocommerce.php'); $file = ''; if (is_single() && get_post_type() == 'product') { $file = 'single-product.php'; $find[] = $file; $find[] = WC_TEMPLATE_PATH . $file; } elseif (is_tax('product_cat') || is_tax('product_tag')) { $term = get_queried_object(); $file = 'taxonomy-' . $term->taxonomy . '.php'; $find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php'; $find[] = WC_TEMPLATE_PATH . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php'; $find[] = $file; $find[] = WC_TEMPLATE_PATH . $file; } elseif (is_post_type_archive('product') || is_page(wc_get_page_id('shop'))) { $file = 'archive-product.php'; $find[] = $file; $find[] = WC_TEMPLATE_PATH . $file; } if ($file) { $template = locate_template($find); $status_options = get_option('woocommerce_status_options', array()); if (!$template || !empty($status_options['template_debug_mode']) && current_user_can('manage_options')) { $template = WC()->plugin_path() . '/templates/' . $file; } } return $template; }
function start_el(&$output, $comment, $depth = 0, $args = array(), $id = 0) { $depth++; $GLOBALS['comment_depth'] = $depth; $GLOBALS['comment'] = $comment; if (!empty($args['callback'])) { call_user_func($args['callback'], $comment, $args, $depth); return; } extract($args, EXTR_SKIP); ?> <li id="comment-<?php comment_ID(); ?> " <?php comment_class('media comment-' . get_comment_ID()); ?> > <?php //include(locate_template('view/loop/comment.php')); ?> <?php include locate_template('comment.php'); ?> <?php }
function cs_framework_init() { // active modules defined('CS_ACTIVE_FRAMEWORK') or define('CS_ACTIVE_FRAMEWORK', true); defined('CS_ACTIVE_METABOX') or define('CS_ACTIVE_METABOX', true); defined('CS_ACTIVE_SHORTCODE') or define('CS_ACTIVE_SHORTCODE', true); defined('CS_ACTIVE_CUSTOMIZE') or define('CS_ACTIVE_CUSTOMIZE', true); // helpers cs_locate_template('functions/deprecated.php'); cs_locate_template('functions/helpers.php'); cs_locate_template('functions/actions.php'); cs_locate_template('functions/enqueue.php'); cs_locate_template('functions/sanitize.php'); cs_locate_template('functions/validate.php'); // classes cs_locate_template('classes/abstract.class.php'); cs_locate_template('classes/options.class.php'); cs_locate_template('classes/framework.class.php'); cs_locate_template('classes/metabox.class.php'); cs_locate_template('classes/taxonomy.class.php'); cs_locate_template('classes/shortcode.class.php'); cs_locate_template('classes/customize.class.php'); // configs require_once locate_template('includes/resource/framework.config.php'); require_once locate_template('includes/resource/metabox.config.php'); require_once locate_template('includes/resource/taxonomy.config.php'); require_once locate_template('includes/resource/shortcode.config.php'); require_once locate_template('includes/resource/customize.config.php'); }
function wplms_dashboard_template() { if (!is_user_logged_in()) { wp_redirect(site_url()); } $template = 'templates/dashboard'; global $bp; if ($bp->current_component == 'dashboard') { wp_enqueue_style('wplms-dashboard-css', WPLMS_DASHBOARD_URL . '/css/wplms-dashboard.css', array(), '1.0'); wp_enqueue_script('wplms-dashboard-js', WPLMS_DASHBOARD_URL . '/js/wplms-dashboard.js', array('jquery', 'jquery-ui-sortable'), '1.0'); if (is_active_widget(false, false, 'wplms_instructor_dash_stats', true) || is_active_widget(false, false, 'wplms_dash_stats', true)) { wp_enqueue_script('wplms-sparkline', WPLMS_DASHBOARD_URL . '/js/jquery.sparkline.min.js', array('jquery'), true); } if (is_active_widget(false, false, 'wplms_instructor_stats', true) || is_active_widget(false, false, 'wplms_instructor_commission_stats', true) || is_active_widget(false, false, 'wplms_student_stats', true)) { wp_enqueue_script('wplms-raphael', WPLMS_DASHBOARD_URL . '/js/raphael-min.js', array('jquery'), true); wp_enqueue_script('wplms-morris', WPLMS_DASHBOARD_URL . '/js/morris.min.js', array('jquery'), true); } $translation_array = array('earnings' => __('Earnings', 'wplms-dashboard'), 'payout' => __('Payout', 'wplms-dashboard'), 'students' => __('# Students', 'wplms-dashboard'), 'saved' => __('SAVED', 'wplms-dashboard'), 'saving' => __('SAVING ...', 'wplms-dashboard'), 'stats_calculated' => __('Stats Calculated, reloading page ...', 'wplms-dashboard')); wp_localize_script('wplms-dashboard-js', 'wplms_dashboard_strings', $translation_array); } $located_template = apply_filters('bp_located_template', locate_template($template, false), $template); if ($located_template && $located_template != '') { bp_get_template_part(apply_filters('bp_load_template', $located_template)); } else { bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/dashboard')); } }
function wps_vc_column_text_shortcode() { // Remove Default Parameters vc_remove_param('vc_column_text', 'css_animation'); vc_remove_param('vc_column_text', 'css'); vc_map_update('vc_column_text', array('html_template' => locate_template('vc_templates/vc_column_text.php'))); }
function optionsframework_init() { // Include the required files require_once dirname(__FILE__) . '/options-interface.php'; require_once dirname(__FILE__) . '/options-medialibrary-uploader.php'; // Loads the options array from the theme if ($optionsfile = locate_template(array('options.php'))) { require_once $optionsfile; } else { if (file_exists(dirname(__FILE__) . '/options.php')) { require_once dirname(__FILE__) . '/options.php'; } } $optionsframework_settings = get_option('optionsframework'); // Updates the unique option id in the database if it has changed optionsframework_option_name(); // Gets the unique id, returning a default if it isn't defined if (isset($optionsframework_settings['id'])) { $option_name = $optionsframework_settings['id']; } else { $option_name = 'optionsframework'; } // If the option has no saved data, load the defaults if (!get_option($option_name)) { optionsframework_setdefaults(); } // Registers the settings fields and callback register_setting('optionsframework', $option_name, 'optionsframework_validate'); // Change the capability required to save the 'optionsframework' options group. add_filter('option_page_capability_optionsframework', 'optionsframework_page_capability'); }
/** * Passes $this->parts() to locate_template() to retrieve template location * @return string Location of template */ public function path() { if (!($path = $this->cache('path'))) { $path = $this->cache('path', locate_template($this->parts())); } return apply_filters('sage/partial_' . basename($path, '.php'), $path, $this->parts()) ?: $path; }
function templates_occasion_includes($template_path) { if (get_post_type() == 'occasions') { wp_enqueue_script('occasion-js'); // prod // wp_enqueue_script('occasion-new-js'); // dev if (is_single()) { wp_enqueue_script('showhide-js'); wp_enqueue_script('contactforms-js'); // checks if the file exists in the theme first, // otherwise serve the file from the plugin if ($theme_file = locate_template(array('single.occasions.php'))) { $template_path = $theme_file; } else { $template_path = plugin_dir_path(__FILE__) . '/single.occasions.php'; } } else { // checks if the file exists in the theme first, // otherwise serve the file from the plugin if ($theme_file = locate_template(array('overview.occasions.php'))) { $template_path = $theme_file; } else { $template_path = plugin_dir_path(__FILE__) . '/overview.occasions.php'; } } } return $template_path; }
function load_member_page() { $id = $_POST['id']; $current_member = get_userdata($id); include locate_template('template-part-member.php'); die; }
function evolve_init() { // Include the required files get_template_part('library/functions/options-interface'); get_template_part('library/functions/options-medialibrary-uploader'); // Loads the options array from the theme if ($optionsfile = locate_template(array('options.php'))) { get_template_part($optionsfile); } else { if (file_exists(dirname(__FILE__) . '/options.php')) { require_once dirname(__FILE__) . '/options.php'; } } $evolve_settings = get_option('evolve'); // Updates the unique option id in the database if it has changed evolve_option_name(); // Gets the unique id, returning a default if it isn't defined if (isset($evolve_settings['id'])) { $option_name = $evolve_settings['id']; } else { $option_name = 'evolve'; } // If the option has no saved data, load the defaults if (!get_option($option_name)) { evolve_setdefaults(); } // Registers the settings fields and callback if (!isset($_POST['evolve-backup-import'])) { register_setting('evolve', $option_name, 'evolve_validate'); } // Instantiate the media uploader class $evolve_media_uploader = new evolve_Framework_Media_Uploader(); $evolve_media_uploader->init(); }
/** * Uses the $comment_type to determine which comment template should be used. * Once the template is located, it is loaded for use. * * Child themes can create custom templates based off the $comment_type. The * comment template hierarchy is comment-$comment_type.php, comment.php. * * Templates are saved in CareLib_Template_Comments::comment_template[$comment_type], * so each comment template is only located once if it is needed. The * following comments will use the saved template. * * @since 1.0.0 * @access public * @param object $comment the comment object. * @param array $args list of arguments passed from wp_list_comments(). * @param integer $depth What level the particular comment is. * @return void */ function carelib_comments_callback($comment, $args, $depth) { static $comment_template = array(); // Get the comment type of the current comment. $comment_type = get_comment_type($comment->comment_ID); // Check if a template has been provided for the specific comment type. If not, get the template. if (!isset($comment_template[$comment_type])) { // Create an array of template files to look for. $templates = array("template-parts/comment/{$comment_type}.php", "comment-{$comment_type}.php"); // If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'. if ('pingback' === $comment_type || 'trackback' === $comment_type) { $templates[] = 'template-parts/comment/ping.php'; $templates[] = 'comment-ping.php'; } // Add the fallback 'comment.php' template. $templates[] = 'template-parts/comment/comment.php'; $templates[] = 'comment.php'; // Allow devs to filter the template hierarchy. $templates = apply_filters("{$GLOBALS['carelib_prefix']}_comment_template_hierarchy", $templates, $comment_type); // Locate the comment template. $template = locate_template($templates); // Set the template in the comment template array. $comment_template[$comment_type] = $template; } // If a template was found, load the template. if (!empty($comment_template[$comment_type])) { require $comment_template[$comment_type]; } }
/** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget($args, $instance) { if ($this->get_cached_widget($args)) { return; } global $job_manager, $post; extract($args); $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); $icon = isset($instance['icon']) ? $instance['icon'] : null; $gallery = Listify_WP_Job_Manager_Gallery::get(get_post()->ID); $limit = isset($instance['limit']) ? $instance['limit'] : 8; $has_more = count($gallery) > $limit; if (empty($gallery) && !current_user_can('upload_files')) { return; } if ($icon) { $before_title = sprintf($before_title, 'ion-' . $icon); } ob_start(); if ($has_more) { $before_widget = str_replace('widget-job_listing', 'widget-job_listing has-more', $before_widget); } echo $before_widget; if ($title) { echo $before_title . sprintf('<a href="%s" class="image-gallery-link">%s</a>', Listify_WP_Job_Manager_Gallery::url(), $title) . $after_title; } include locate_template(array('content-single-job_listing-gallery-overview.php')); if ($has_more) { printf('<a href="%s" class="go-to-gallery"><i class="ion-ios7-more"></i></a>', Listify_WP_Job_Manager_Gallery::url()); } echo $after_widget; $content = ob_get_clean(); echo apply_filters($this->widget_id, $content); $this->cache_widget($args, $content); }
/** * Build the required object instance * * @param string $object * @param boolean $fresh whether to get a fresh copy; will not be cached and won't override * current copy in cache. */ public static function factory($object = 'core', $fresh = false) { if (isset(self::$_cache[$object]) && !$fresh) { return self::$_cache[$object]; } // pre-defined class relation? if (!empty(self::$_registered[$object]['class'])) { $class = self::$_registered[$object]['class']; } else { // convert short-codes to Bunyad_ShortCodes; core to Bunyad_Core etc. $class = str_replace('/', '_', $object); $class = apply_filters('bunyad_factory_class', 'Bunyad_' . self::file_to_class_name($class)); } // try auto-loading the class if (!class_exists($class)) { // locate file in child theme or parent theme lib $file = locate_template('lib/' . $object . '.php'); if ($file) { require_once $file; } } // class not found if (!class_exists($class)) { return false; } // don't cache fresh objects if ($fresh) { return new $class(); } self::$_cache[$object] = new $class(); return self::$_cache[$object]; }
/** * Loads theme files in appropriate hierarchy: * 1) child theme and * 2) parent template will look in the wpinventory/views directory * 3) views/ directory in the plugin * * @param string $template template file to search for * @return template path **/ public static function get($template) { // append .php to file name if (substr($template, -4) != '.php') { $template .= '.php'; } $file = FALSE; // check if there are overrides at all if (locate_template(array(self::VIEWFOLDER))) { $overrides_exist = TRUE; } else { $overrides_exist = FALSE; } if ($overrides_exist) { // check the theme for specific file requested $file = locate_template(array(self::VIEWFOLDER . $template), FALSE, FALSE); } // if the theme file wasn't found, check our plugins views dirs if (!$file) { $file = self::$path . 'views/' . $template; } if (!file_exists($file)) { $file = FALSE; } return apply_filters('wpinventory_template_' . $template, $file); }
/** * A version of load_template() with support for passing arbitrary values. * * @param string|array Template name(s) to pass to locate_template() * @param array Additional data */ function appthemes_load_template($templates, $data = array()) { $located = locate_template($templates); if (!$located) { $framework_parent_path = rtrim(APP_FRAMEWORK_DIR, APP_FRAMEWORK_DIR_NAME); foreach ((array) $templates as $template_name) { if (empty($template_name)) { continue; } if (file_exists($framework_parent_path . $template_name)) { $located = $framework_parent_path . $template_name; break; } } } if (!$located) { return; } global $posts, $post, $wp_query, $wp_rewrite, $wpdb, $comment; extract($data, EXTR_SKIP); if (is_array($wp_query->query_vars)) { extract($wp_query->query_vars, EXTR_SKIP); } require $located; }
/** * Clean up class constructor, check for configuration or informations * in the manifest * * @param array $configuration cleanUp configuration * @return void * * @link https://codex.wordpress.org/Function_Reference/locate_template * @uses CleanUp::adminCleanUp() */ public function __construct($configuration = []) { // load manifest with an empty configuration if (count($configuration) === 0) { $file = locate_template($file); $file = file_get_contents($file); $manifest = json_decode($file, true); if (array_key_exists('theme-features', $manifest) && array_key_exists('cleanup', $manifest['theme-features'])) { $configuration = $manifest['theme-features']['cleanup']; } } if (is_array($configuration)) { $this->cleanUp = array_merge($this->default, $configuration); } else { Tools::parseBooleans($configuration); if ($configuration) { $this->cleanUp = $this->default; } } // we call admin clean up parts, if asked in the manifest $this->adminCleanUp(); // we call default theme clean up parts, if asked in the manifest if (array_key_exists('themes', $this->cleanUp)) { if ($this->cleanUp['themes']) { $this->defaultThemesCleanUp(); } } }
function layers_load_template($template) { // Get registered template locations $template_locations = layers_get_template_locations(); // Get the base name of the file to look for $template_slug = basename($template); // Set the default file $file = $template; // Check if a custom template exists in the theme folder, if not, load the plugin template file if (!empty($template_locations)) { // Loop through the registered template locations foreach ($template_locations as $location) { // Piece together the ful url $extension_file = $location . '/' . $template_slug; // If this template file exists, we're game if (file_exists($extension_file)) { $file = $extension_file; break; } } } elseif ($theme_file = locate_template($template_slug)) { $file = $theme_file; } return apply_filters('layers_template_' . $template, $file); }
/** * Uses the $comment_type to determine which comment template should be used. Once the * template is located, it is loaded for use. Child themes can create custom templates based off * the $comment_type. The comment template hierarchy is comment-$comment_type.php, * comment.php. * * The templates are saved in $hybrid->comment_template[$comment_type], so each comment template * is only located once if it is needed. Following comments will use the saved template. * * @since 0.2.3 * @access public * @param $comment The comment object. * @param $args Array of arguments passed from wp_list_comments(). * @param $depth What level the particular comment is. * @return void */ function hybrid_comments_callback($comment, $args, $depth) { global $hybrid; $GLOBALS['comment'] = $comment; $GLOBALS['comment_depth'] = $depth; /* Get the comment type of the current comment. */ $comment_type = get_comment_type($comment->comment_ID); /* Create an empty array if the comment template array is not set. */ if (!isset($hybrid->comment_template) || !is_array($hybrid->comment_template)) { $hybrid->comment_template = array(); } /* Check if a template has been provided for the specific comment type. If not, get the template. */ if (!isset($hybrid->comment_template[$comment_type])) { /* Create an array of template files to look for. */ $templates = array("comment-{$comment_type}.php"); /* If the comment type is a 'pingback' or 'trackback', allow the use of 'comment-ping.php'. */ if ('pingback' == $comment_type || 'trackback' == $comment_type) { $templates[] = 'comment-ping.php'; } /* Add the fallback 'comment.php' template. */ $templates[] = 'comment.php'; /* Locate the comment template. */ $template = locate_template($templates); /* Set the template in the comment template array. */ $hybrid->comment_template[$comment_type] = $template; } /* If a template was found, load the template. */ if (!empty($hybrid->comment_template[$comment_type])) { require $hybrid->comment_template[$comment_type]; } }
/** * Loads template part file * * @param string $slug The slug name for the generic template or sub-directory * @param string $name The name of the specialised template * @param bool $echo Echo output immediately or buffered and returned * @param array $param Array of additional params to include in scope */ function try_get_template_part($slug, $name, $echo = true, $params = array()) { global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID; do_action("get_template_part_{$slug}", $slug, $name); $templates = array(); if (isset($name)) { $templates[] = "{$slug}/{$name}.php"; $templates[] = "{$slug}-{$name}.php"; } $templates[] = "{$slug}.php"; $template_file = locate_template($templates, false, false); // Add query vars and params to scope if (is_array($wp_query->query_vars)) { extract($wp_query->query_vars, EXTR_SKIP); } extract($params, EXTR_SKIP); // Buffer output and return if echo is false if (!$echo) { ob_start(); } require $template_file; if (!$echo) { return ob_get_clean(); } }
public static function disaply_pdf_book($atts = array()) { global $pdf_light_viewer_config; if (!isset($atts['id']) || !$atts['id']) { return; } $post = get_post($atts['id']); if (empty($post) || !$post->ID) { return; } $pdf_light_viewer_config = static::getConfig($atts, $post); ob_start(); ob_clean(); // the loop if (locate_template($pdf_light_viewer_config['template'] . '.php') != '') { get_template_part($pdf_light_viewer_config['template']); } else { if (file_exists(PDF_LIGHT_VIEWER_APPPATH . '/templates/' . $pdf_light_viewer_config['template'] . '.php')) { include PDF_LIGHT_VIEWER_APPPATH . '/templates/' . $pdf_light_viewer_config['template'] . '.php'; } else { include PDF_LIGHT_VIEWER_APPPATH . '/templates/shortcode-pdf-light-viewer.php'; } } return ob_get_clean(); }
/** * Load a template. * * Handles template usage so that we can use our own templates instead of the themes. * * Templates are in the 'templates' folder. woocommerce looks for theme * overrides in /theme/woocommerce/ by default * * For beginners, it also looks for a woocommerce.php template first. If the user adds * this to the theme (containing a woocommerce() inside) this will be used for all * woocommerce templates. * * @param mixed $template * @return string */ public static function template_loader($template) { $find = array('woocommerce.php'); $file = ''; if (is_single() && get_post_type() == 'product') { $file = 'single-product.php'; $find[] = $file; $find[] = WC()->template_path() . $file; } elseif (is_product_taxonomy()) { $term = get_queried_object(); if (is_tax('product_cat') || is_tax('product_tag')) { $file = 'taxonomy-' . $term->taxonomy . '.php'; } else { $file = 'archive-product.php'; } $find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php'; $find[] = WC()->template_path() . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php'; $find[] = 'taxonomy-' . $term->taxonomy . '.php'; $find[] = WC()->template_path() . 'taxonomy-' . $term->taxonomy . '.php'; $find[] = $file; $find[] = WC()->template_path() . $file; } elseif (is_post_type_archive('product') || is_page(wc_get_page_id('shop'))) { $file = 'archive-product.php'; $find[] = $file; $find[] = WC()->template_path() . $file; } if ($file) { $template = locate_template(array_unique($find)); if (!$template || WC_TEMPLATE_DEBUG_MODE) { $template = WC()->plugin_path() . '/templates/' . $file; } } return $template; }