本文整理汇总了PHP中locate_template函数的典型用法代码示例。如果您正苦于以下问题:PHP locate_template函数的具体用法?PHP locate_template怎么用?PHP locate_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了locate_template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: include_theme_conf
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);
}
示例2: locate_file
/**
* 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;
}
示例3: nimbus_cotizador
function nimbus_cotizador($atts, $content)
{
extract($atts);
set_query_var('success', $action);
$template = locate_template("/templates/quote.php");
load_template($template);
}
示例4: kohana_page_template_filter
/**
* 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;
}
示例5: presscore_load_meta_boxes
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");
}
}
示例6: get_job_manager_template_part
/**
* 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);
}
}
示例7: form
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');
}
示例8: showSlider
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');
}
}
示例9: widget
/**
* @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();
}
示例10: template_loader
/**
* 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;
}
示例11: start_el
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
}
示例12: cs_framework_init
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');
}
示例13: wplms_dashboard_template
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'));
}
}
示例14: wps_vc_column_text_shortcode
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')));
}
示例15: optionsframework_init
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');
}