本文整理汇总了PHP中locate_template函数的典型用法代码示例。如果您正苦于以下问题:PHP locate_template函数的具体用法?PHP locate_template怎么用?PHP locate_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了locate_template函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:softcatala,项目名称:wp-softcatala,代码行数:7,代码来源:functions.php
示例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;
}
开发者ID:zgomotos,项目名称:Bazar,代码行数:16,代码来源:Cache.php
示例3: nimbus_cotizador
function nimbus_cotizador($atts, $content)
{
extract($atts);
set_query_var('success', $action);
$template = locate_template("/templates/quote.php");
load_template($template);
}
开发者ID:ricardomangore,项目名称:nimbus,代码行数:7,代码来源:nimbus_short_codes.php
示例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;
}
开发者ID:kerkness,项目名称:kohana-for-wordpress,代码行数:13,代码来源:kohana-for-wordpress.php
示例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");
}
}
开发者ID:noman90rauf,项目名称:wp-content,代码行数:7,代码来源:load-meta-boxes.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);
}
}
开发者ID:dot2006,项目名称:jobify,代码行数:32,代码来源:wp-job-manager-template.php
示例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');
}
开发者ID:petrfaitl,项目名称:wordpress-event-theme,代码行数:7,代码来源: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');
}
}
开发者ID:gabzon,项目名称:experiensa,代码行数:32,代码来源:Slider.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();
}
开发者ID:ninefinecode,项目名称:ninefinecode,代码行数:30,代码来源:widgets.php
示例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;
}
开发者ID:chhavinav,项目名称:fr.ilovejuice,代码行数:44,代码来源:class-wc-template-loader.php
示例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
}
开发者ID:riesurya,项目名称:DeVioPlayground,代码行数:27,代码来源:DeVioPlaygroundPro_Main_Functions.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');
}
开发者ID:wowthemes,项目名称:codestar-framework,代码行数:29,代码来源:cs-framework.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'));
}
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:27,代码来源:functions.php
示例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')));
}
开发者ID:Zsolt-R,项目名称:wps-prime,代码行数:7,代码来源:wps-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');
}
开发者ID:foxydot,项目名称:madvia,代码行数:31,代码来源:options-framework.php
示例16: path
/**
* 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;
}
开发者ID:vitaligent,项目名称:sage,代码行数:11,代码来源:Partial.php
示例17: templates_occasion_includes
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;
}
开发者ID:daanbakker1995,项目名称:lba-doorlinken-voorraad,代码行数:28,代码来源:include.templates.php
示例18: load_member_page
function load_member_page()
{
$id = $_POST['id'];
$current_member = get_userdata($id);
include locate_template('template-part-member.php');
die;
}
开发者ID:synergia,项目名称:mknm-synergia-theme,代码行数:7,代码来源:ajax.php
示例19: evolve_init
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();
}
开发者ID:thejasonhsu,项目名称:Illumin,代码行数:34,代码来源:options-framework.php
示例20: carelib_comments_callback
/**
* 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];
}
}
开发者ID:wpsitecare,项目名称:carelib,代码行数:47,代码来源:template-comments.php
注:本文中的locate_template函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论