本文整理汇总了PHP中get_index_template函数的典型用法代码示例。如果您正苦于以下问题:PHP get_index_template函数的具体用法?PHP get_index_template怎么用?PHP get_index_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_index_template函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: redirect_expired
function redirect_expired()
{
global $wp_query;
if (is_singular()) {
if ('expired' == $wp_query->post->post_status) {
if (function_exists('is_syndicated') and is_syndicated($wp_query->post->ID)) {
$source = get_syndication_feed_object($wp_query->post->ID);
$redirect_url = $source->setting('expired post redirect to', 'expired_post_redirect_to', NULL);
} else {
$redirect_url = get_option('feedwordpress_expired_post_redirect_to', NULL);
}
if (!is_null($redirect_url) and strlen(esc_url($redirect_url)) > 0 and 'none' != $redirect_url) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: " . $redirect_url);
} else {
// Meh.
if (!($template = get_404_template())) {
$template = get_index_template();
}
if ($template = apply_filters('template_include', $template)) {
header("HTTP/1.1 410 Gone");
include $template;
}
}
exit;
}
}
}
开发者ID:radgeek,项目名称:fwp-limit-posts-by-date,代码行数:28,代码来源:fwp-limit-posts-by-date.php
示例2: getWpTemplate
function getWpTemplate()
{
if (defined('WP_USE_THEMES') && WP_USE_THEMES) {
$template = false;
if (is_404() && ($template = get_404_template())) {
} elseif (is_search() && ($template = get_search_template())) {
} elseif (is_tax() && ($template = get_taxonomy_template())) {
} elseif (is_front_page() && ($template = get_front_page_template())) {
} elseif (is_home() && ($template = get_home_template())) {
} elseif (is_attachment() && ($template = get_attachment_template())) {
} elseif (is_single() && ($template = get_single_template())) {
} elseif (is_page() && ($template = get_page_template())) {
} elseif (is_category() && ($template = get_category_template())) {
} elseif (is_tag() && ($template = get_tag_template())) {
} elseif (is_author() && ($template = get_author_template())) {
} elseif (is_date() && ($template = get_date_template())) {
} elseif (is_archive() && ($template = get_archive_template())) {
} elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
} elseif (is_paged() && ($template = get_paged_template())) {
} else {
$template = get_index_template();
}
return str_replace(ABSPATH, '', $template);
} else {
return null;
}
}
开发者ID:jtomeck,项目名称:jtwebfolio,代码行数:27,代码来源:showThemeFile.php
示例3: get_404_template
private static function get_404_template()
{
if (!($template = get_404_template())) {
$template = get_index_template();
}
return $template;
}
开发者ID:voceconnect,项目名称:voce-post-pdfs,代码行数:7,代码来源:voce-post-pdfs.php
示例4: templateChooser
/**
* Pick the correct template to include
* @param string $template Path to template
*
* @return string Path to template
*/
public static function templateChooser($template)
{
$events = TribeEvents::instance();
do_action('tribe_tec_template_chooser', $template);
// hijack this method right up front if it's a 404
if (is_404() && $events->displaying == 'single-event' && apply_filters('tribe_events_templates_is_404', '__return_true')) {
return get_404_template();
}
// no non-events need apply
if (!in_array(get_query_var('post_type'), array(TribeEvents::POSTTYPE, TribeEvents::VENUE_POST_TYPE, TribeEvents::ORGANIZER_POST_TYPE)) && !is_tax(TribeEvents::TAXONOMY)) {
return $template;
}
if (tribe_get_option('tribeEventsTemplate', 'default') == '') {
return self::getTemplateHierarchy('default-template');
} else {
// add_filter( 'wp_title', array(__CLASS__, 'remove_default_title'), 1);
if (!is_single() || !post_password_required()) {
add_action('loop_start', array(__CLASS__, 'setup_ecp_template'));
}
$template = locate_template(tribe_get_option('tribeEventsTemplate', 'default') == 'default' ? 'page.php' : tribe_get_option('tribeEventsTemplate', 'default'));
if ($template == '') {
$template = get_index_template();
}
// remove singular body class if sidebar-page.php
if ($template == get_stylesheet_directory() . '/sidebar-page.php') {
add_filter('body_class', array(__CLASS__, 'remove_singular_body_class'));
} else {
add_filter('body_class', array(__CLASS__, 'add_singular_body_class'));
}
return $template;
}
}
开发者ID:TyRichards,项目名称:river_of_life,代码行数:38,代码来源:tribe-templates.class.php
示例5: carelib_index_include
/**
* Override WP's default index.php template.
*
* Because we don't really use index.php, this prevents searching for
* templates multiple times when trying to load the default template.
*
* @since 1.0.0
* @access public
* @param string $template
* @return string $template
*/
function carelib_index_include($template)
{
if (get_index_template() === $template) {
return carelib_framework(apply_filters("{$GLOBALS['carelib_prefix']}_index_template", null));
}
return $template;
}
开发者ID:wpsitecare,项目名称:carelib,代码行数:18,代码来源:template-hierarchy.php
示例6: templateChooser
public static function templateChooser($template)
{
$events = TribeEvents::instance();
do_action('tribe_tec_template_chooser', $template);
// no non-events need apply
if (get_query_var('post_type') != TribeEvents::POSTTYPE && !is_tax(TribeEvents::TAXONOMY) && get_query_var('post_type') != TribeEvents::VENUE_POST_TYPE) {
return $template;
}
//is_home fixer
global $wp_query;
$wp_query->is_home = false;
if (tribe_get_option('tribeEventsTemplate', 'default') == '') {
if (is_single() && !tribe_is_showing_all()) {
return TribeEventsTemplates::getTemplateHierarchy('ecp-single-template');
} else {
return TribeEventsTemplates::getTemplateHierarchy('ecp-page-template');
}
} else {
// we need to ensure that we always enter the loop, whether or not there are any events in the actual query
self::spoofQuery();
add_filter('wp_title', array(__CLASS__, 'remove_default_title'), 1);
add_action('loop_start', array(__CLASS__, 'setup_ecp_template'));
$template = locate_template(tribe_get_option('tribeEventsTemplate', 'default') == 'default' ? 'page.php' : tribe_get_option('tribeEventsTemplate', 'default'));
if ($template == '') {
$template = get_index_template();
}
// remove singular body class if sidebar-page.php
if ($template == get_stylesheet_directory() . '/sidebar-page.php') {
add_filter('body_class', array(__CLASS__, 'remove_singular_body_class'));
}
return $template;
}
}
开发者ID:mpaskew,项目名称:isc-dev,代码行数:33,代码来源:tribe-templates.class.php
示例7: load_template
/**
* Copy-pasta of wp-includes/template-loader.php
*/
private function load_template()
{
do_action('template_redirect');
$template = false;
if (is_404() && ($template = get_404_template())) {
} elseif (is_search() && ($template = get_search_template())) {
} elseif (is_front_page() && ($template = get_front_page_template())) {
} elseif (is_home() && ($template = get_home_template())) {
} elseif (is_post_type_archive() && ($template = get_post_type_archive_template())) {
} elseif (is_tax() && ($template = get_taxonomy_template())) {
} elseif (is_attachment() && ($template = get_attachment_template())) {
remove_filter('the_content', 'prepend_attachment');
} elseif (is_single() && ($template = get_single_template())) {
} elseif (is_page() && ($template = get_page_template())) {
} elseif (is_category() && ($template = get_category_template())) {
} elseif (is_tag() && ($template = get_tag_template())) {
} elseif (is_author() && ($template = get_author_template())) {
} elseif (is_date() && ($template = get_date_template())) {
} elseif (is_archive() && ($template = get_archive_template())) {
} elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
} elseif (is_paged() && ($template = get_paged_template())) {
} else {
$template = get_index_template();
}
/**
* Filter the path of the current template before including it.
*
* @since 3.0.0
*
* @param string $template The path of the template to include.
*/
if ($template = apply_filters('template_include', $template)) {
$template_contents = file_get_contents($template);
$included_header = $included_footer = false;
if (false !== stripos($template_contents, 'get_header();')) {
do_action('get_header', null);
locate_template('header.php', true, false);
$included_header = true;
}
include $template;
if (false !== stripos($template_contents, 'get_footer();')) {
do_action('get_footer', null);
locate_template('footer.php', true, false);
$included_footer = true;
}
if ($included_header && $included_footer) {
global $wp_scripts;
$wp_scripts->done = array();
}
}
return;
}
开发者ID:danielbachhuber,项目名称:unholy,代码行数:55,代码来源:class-unholy-testcase.php
示例8: xtreme_get_template
function xtreme_get_template()
{
global $wp;
if (defined('WP_USE_THEMES') && constant('WP_USE_THEMES')) {
if (is_404() && ($template = get_404_template())) {
return redefine_pagenow($template);
} elseif (is_search() && ($template = get_search_template())) {
return redefine_pagenow($template);
} elseif (is_tax() && ($template = get_taxonomy_template())) {
return redefine_pagenow($template);
} elseif (is_front_page() && ($template = get_front_page_template())) {
return redefine_pagenow($template);
} elseif (is_home() && ($template = get_home_template())) {
return redefine_pagenow($template);
} elseif (is_attachment() && ($template = get_attachment_template())) {
return redefine_pagenow($template);
} elseif (is_single() && ($template = get_single_template())) {
return redefine_pagenow($template);
} elseif (is_page() && ($template = get_page_template())) {
return redefine_pagenow($template);
} elseif (is_category() && ($template = get_category_template())) {
return redefine_pagenow($template);
} elseif (is_tag() && ($template = get_tag_template())) {
return redefine_pagenow($template);
} elseif (is_author() && ($template = get_author_template())) {
return redefine_pagenow($template);
} elseif (is_date() && ($template = get_date_template())) {
return redefine_pagenow($template);
} elseif (is_archive() && ($template = get_archive_template())) {
return redefine_pagenow($template);
} elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
return redefine_pagenow($template);
} elseif (is_paged() && ($template = get_paged_template())) {
return redefine_pagenow($template);
} else {
$template = get_index_template();
return redefine_pagenow($template);
}
}
}
开发者ID:katikos,项目名称:xtreme-one,代码行数:40,代码来源:xtreme-template-loader.php
示例9: choose_template
/**
* Get the fork's parent post, set up a query, and load correct template.
*
* Duplicates the functionality of /wp-includes/template-loader.php and includes
* a lot of copypasta, but that's only to ensure that it follows the same logic.
*
*/
function choose_template()
{
$p = get_queried_object_id();
if (get_post_type($p) !== 'fork') {
return;
}
$pp = get_post($p)->post_parent;
$parent = get_post($pp);
if ($parent->post_type == 'page') {
$query = array('page_id' => $pp);
} else {
$query = array('p' => $pp);
}
$t = new WP_Query($query);
$template = false;
if ($t->is_404() && ($template = get_404_template())) {
} elseif ($t->is_search() && ($template = get_search_template())) {
} elseif ($t->is_tax() && ($template = get_taxonomy_template())) {
} elseif ($t->is_front_page() && ($template = get_front_page_template())) {
} elseif ($t->is_home() && ($template = get_home_template())) {
} elseif ($t->is_attachment() && ($template = get_attachment_template())) {
remove_filter('the_content', 'prepend_attachment');
} elseif ($t->is_single() && ($template = get_single_template())) {
} elseif ($t->is_page && ($template = get_page_template())) {
} elseif ($t->is_category() && ($template = get_category_template())) {
} elseif ($t->is_tag() && ($template = get_tag_template())) {
} elseif ($t->is_author() && ($template = get_author_template())) {
} elseif ($t->is_date() && ($template = get_date_template())) {
} elseif ($t->is_archive() && ($template = get_archive_template())) {
} elseif ($t->is_comments_popup() && ($template = get_comments_popup_template())) {
} elseif ($t->is_paged() && ($template = get_paged_template())) {
} else {
$template = get_index_template();
}
if ($template = apply_filters('template_include', $template)) {
include $template;
}
return;
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:46,代码来源:preview.php
示例10: templateChooser
/**
* Pick the correct template to include
* @param string $template Path to template
*
* @return string Path to template
*/
public static function templateChooser($template)
{
$events = TribeEvents::instance();
do_action('tribe_tec_template_chooser', $template);
// hijack this method right up front if it's a 404
if (is_404() && $events->displaying == 'single-event') {
return get_404_template();
}
// add the theme slug to the body class
add_filter('body_class', array(__CLASS__, 'theme_body_class'));
// add the template name to the body class
add_filter('body_class', array(__CLASS__, 'template_body_class'));
// no non-events need apply
// @todo check $wp_query->tribe_is_event_query instead?
if (in_array(get_query_var('post_type'), array(TribeEvents::POSTTYPE, TribeEvents::VENUE_POST_TYPE, TribeEvents::ORGANIZER_POST_TYPE)) || is_tax(TribeEvents::TAXONOMY)) {
// user has selected a page/custom page template
if (tribe_get_option('tribeEventsTemplate', 'default') != '') {
if (!is_single() || !post_password_required()) {
add_action('loop_start', array(__CLASS__, 'setup_ecp_template'));
}
$template = locate_template(tribe_get_option('tribeEventsTemplate', 'default') == 'default' ? 'page.php' : tribe_get_option('tribeEventsTemplate', 'default'));
if ($template == '') {
$template = get_index_template();
}
// remove singular body class if sidebar-page.php
if ($template == get_stylesheet_directory() . '/sidebar-page.php') {
add_filter('body_class', array(__CLASS__, 'remove_singular_body_class'));
} else {
add_filter('body_class', array(__CLASS__, 'add_singular_body_class'));
}
} else {
$template = self::getTemplateHierarchy('default-template');
}
}
self::$template = $template;
return $template;
}
开发者ID:estrategasdigitales,项目名称:Golone,代码行数:43,代码来源:tribe-templates.class.php
示例11: check_template
function check_template()
{
if (is_404() && ($template = get_404_template())) {
$this->template = $template;
} elseif (is_search() && ($template = get_search_template())) {
$this->template = $template;
} elseif (is_tax() && ($template = get_taxonomy_template())) {
$this->template = $template;
} elseif (is_home() && ($template = get_home_template())) {
$this->template = $template;
} elseif (is_attachment() && ($template = get_attachment_template())) {
$this->template = $template;
} elseif (is_single() && ($template = get_single_template())) {
$this->template = $template;
} elseif (is_page() && ($template = get_page_template())) {
$this->template = $template;
} elseif (is_category() && ($template = get_category_template())) {
$this->template = $template;
} elseif (is_tag() && ($template = get_tag_template())) {
$this->template = $template;
} elseif (is_author() && ($template = get_author_template())) {
$this->template = $template;
} elseif (is_date() && ($template = get_date_template())) {
$this->template = $template;
} elseif (is_archive() && ($template = get_archive_template())) {
$this->template = $template;
} elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
$this->template = $template;
} elseif (is_paged() && ($template = get_paged_template())) {
$this->template = $template;
} else {
$this->template = function_exists('get_index_template') ? get_index_template() : TEMPLATEPATH . "/index.php";
}
$this->template = apply_filters('template_include', $this->template);
// Hook into the footer so we can echo the active template
add_action('wp_footer', array(&$this, 'show_template'), 100);
}
开发者ID:ksolomon,项目名称:Solo-Frame,代码行数:37,代码来源:show-template.php
示例12: mfields_locate_custom_template
function mfields_locate_custom_template()
{
global $wp_post_types, $wp;
if (is_404()) {
if (array_key_exists($wp->request, $wp_post_types)) {
$file = STYLESHEETPATH . '/' . $wp->request . '-multiple.php';
$file = file_exists($file) ? $file : get_index_template();
return $file;
}
}
return false;
}
开发者ID:bichhuynguyen,项目名称:template-development,代码行数:12,代码来源:functions.php
示例13: templateChooser
/**
* Pick the correct template to include
*
* @param string $template Path to template
*
* @return string Path to template
*/
public static function templateChooser($template)
{
$events = Tribe__Events__Main::instance();
do_action('tribe_tec_template_chooser', $template);
// no non-events need apply
if (!tribe_is_event_query()) {
return $template;
}
// if it's a single 404 event
if (is_single() && is_404()) {
return get_404_template();
}
if (!is_single() && !tribe_events_is_view_enabled($events->displaying)) {
return get_404_template();
}
// add the theme slug to the body class
add_filter('body_class', array(__CLASS__, 'theme_body_class'));
// add the template name to the body class
add_filter('body_class', array(__CLASS__, 'template_body_class'));
// user has selected a page/custom page template
if (tribe_get_option('tribeEventsTemplate', 'default') != '') {
if (!is_single() || !post_password_required()) {
add_action('loop_start', array(__CLASS__, 'setup_ecp_template'));
}
$template = locate_template(tribe_get_option('tribeEventsTemplate', 'default') == 'default' ? 'page.php' : tribe_get_option('tribeEventsTemplate', 'default'));
if ($template == '') {
$template = get_index_template();
}
// remove singular body class if sidebar-page.php
if ($template == get_stylesheet_directory() . '/sidebar-page.php') {
add_filter('body_class', array(__CLASS__, 'remove_singular_body_class'));
} else {
add_filter('body_class', array(__CLASS__, 'add_singular_body_class'));
}
} else {
$template = self::getTemplateHierarchy('default-template');
}
self::$template = $template;
return $template;
}
开发者ID:TMBR,项目名称:johnjohn,代码行数:47,代码来源:Templates.php
示例14: wp_idea_stream_set_template
/**
* Set the template to use, buffers the needed template parts
* and resets post vars.
*
* @package WP Idea Stream
* @subpackage core/template-loader
*
* @since 2.0.0
*
* @global $wp_query
* @param string $template name of the template to use
* @uses is_buddypress() to bail early if it's this plugin's territory
* @uses wp_idea_stream_get_idea_var() to get a globalized var
* @uses is_404() to check for a 404
* @uses get_query_template() to get a specific template
* @uses get_index_template() to get the index template
* @uses wp_idea_stream_set_idea_var() to set a globalized var
* @uses is_post_type_archive() to check if it's ideas post type archive
* @uses wp_idea_stream_get_post_type() to get ideas post type identifier
* @uses set_query_var() to get a query var
* @uses remove_all_filters() to remove all filters on a specific hook
* @uses wp_idea_stream_reset_post() to reset WordPress $post global and avoid notices
* @uses wp_idea_stream_reset_post_title() to reset the title depending on the context
* @uses wp_idea_stream_buffer_template_part() to buffer the content to display
* @uses wp_idea_stream_is_edit() to check if the idea is to be edited
* @uses wp_idea_stream_ideas_lock_idea() to check if the idea to edit is not currently edited by another user
* @uses wp_idea_stream_add_message() to give a user some feedback
* @uses wp_idea_stream_ideas_can_edit() to check current user can edit an idea
* @uses wp_safe_redirect() to safely redirect the user
* @uses wp_idea_stream_get_redirect_url() to get the default redirect url
* @uses wp_idea_stream_buffer_single_idea() to buffer the idea content to display
* @uses do_action() Calls 'wp_idea_stream_set_core_template' to perform actions once a core template is set
* Calls 'wp_idea_stream_set_single_template' to perform actions relative to the single idea template
* Calls 'wp_idea_stream_set_template' to perform actions when no template matched
* @uses apply_filters() Calls 'wp_idea_stream_template_args' to override template args in case of custom idea action
* Calls 'wp_idea_stream_single_template_args' to override single template args
* @return string $template.
*/
function wp_idea_stream_set_template($template = '')
{
global $wp_query;
/**
* Bail if BuddyPress, we'll use its theme compatibility
* feature.
*/
if (function_exists('is_buddypress') && is_buddypress()) {
return $template;
}
if (wp_idea_stream_get_idea_var('is_ideastream') && !is_404()) {
// Try to see if the theme has a specific template for WP Idea Stream
$template = get_query_template('ideastream');
if (empty($template)) {
// else Try the page template
$template = get_query_template('page', array('page.php'));
}
if (empty($template)) {
// finally fall back to the index template
$template = get_index_template();
}
// Define it into plugin's vars
wp_idea_stream_set_idea_var('template_file', $template);
/**
* First get results of the main query if not on a single idea.
* and build plugin's main_query var.
*/
if (!wp_idea_stream_is_single_idea()) {
wp_idea_stream_set_idea_var('main_query', array('ideas' => $wp_query->posts, 'total' => $wp_query->found_posts, 'query_vars' => array('author' => $wp_query->query_vars['author'], 'per_page' => $wp_query->query_vars['posts_per_page'], 'page' => !empty($wp_query->query_vars['paged']) ? $wp_query->query_vars['paged'] : 1, 'search' => $wp_query->query_vars['s'], 'exclude' => $wp_query->query_vars['post__not_in'], 'include' => $wp_query->query_vars['post__in'], 'orderby' => !empty($wp_query->query_vars['orderby']) ? $wp_query->query_vars['orderby'] : 'date', 'order' => $wp_query->query_vars['order'], 'meta_query' => $wp_query->meta_query->queries, 'tax_query' => $wp_query->tax_query->queries)));
// Resetting the 's' query var now we got main query's result.
set_query_var('s', '');
// Init template args
$template_args = array('post_title' => '', 'comment_status' => 'closed', 'is_archive' => true, 'is_tax' => false, 'template_slug' => 'archive', 'template_name' => '', 'context' => '');
// Main plugin's archive page
if (is_post_type_archive(wp_idea_stream_get_post_type())) {
$template_args['context'] = 'archive';
}
// Category / tag archive pages
if (wp_idea_stream_get_idea_var('is_category') || wp_idea_stream_get_idea_var('is_tag')) {
$template_args['is_tax'] = true;
$template_args['context'] = 'taxonomy';
}
// User's profile pages
if (wp_idea_stream_get_idea_var('is_user')) {
$template_args['template_slug'] = 'user';
$template_args['template_name'] = 'profile';
$template_args['context'] = 'user-profile';
}
if (wp_idea_stream_get_idea_var('is_action')) {
$template_args['is_archive'] = false;
// New idea form
if (wp_idea_stream_is_addnew()) {
$template_args['template_slug'] = 'idea';
$template_args['template_name'] = 'form';
$template_args['context'] = 'new-idea';
} else {
if (wp_idea_stream_is_signup()) {
$template_args['template_slug'] = 'signup';
$template_args['context'] = 'signup';
// Allow plugins to add custom action
} else {
if (has_filter('wp_idea_stream_template_args')) {
//.........这里部分代码省略.........
开发者ID:BoweFrankema,项目名称:wp-idea-stream,代码行数:101,代码来源:template-loader.php
示例15: wpsc_all_products_on_page
function wpsc_all_products_on_page()
{
if (is_404()) {
return;
}
global $wp_query, $wpsc_query;
do_action('wpsc_swap_the_template');
$products_page_id = wpsc_get_the_post_id_by_shortcode('[productspage]');
$term = get_query_var('wpsc_product_category');
$tax_term = get_query_var('product_tag');
$obj = $wp_query->get_queried_object();
$id = isset($obj->ID) ? $obj->ID : null;
if (get_query_var('post_type') == 'wpsc-product' || $term || $tax_term || $id == $products_page_id) {
$templates = array();
if ($term && !is_single()) {
array_push($templates, "taxonomy-wpsc_product_category-{$term}.php", 'taxonomy-wpsc_product_category.php');
}
if ($tax_term && !is_single()) {
array_push($templates, "taxonomy-product_tag-{$tax_term}.php", 'taxonomy-product_tag.php');
}
// Attempt to use the [productspage]'s custom page template as a higher priority than the normal page.php template
if (false !== ($productspage_page_template = get_post_meta($products_page_id, '_wp_page_template', true))) {
array_push($templates, $productspage_page_template);
}
array_push($templates, 'page.php', 'single.php');
if (is_single()) {
array_unshift($templates, 'single-wpsc-product.php');
}
// have to pass 'page' as the template type. This is lame, btw, and needs a rewrite in 4.0
if (!($template = get_query_template('page', $templates))) {
$template = get_index_template();
}
add_filter('thesis_custom_loop', 'wpsc_thesis_compat');
include $template;
exit;
}
}
开发者ID:androidprojectwork,项目名称:WP-e-Commerce,代码行数:37,代码来源:page.php
示例16: getContent
private function getContent()
{
$template = false;
if (is_404() && ($template = get_404_template())) {
} elseif (is_search() && ($template = get_search_template())) {
} elseif (is_tax() && ($template = get_taxonomy_template())) {
} elseif (is_front_page() && ($template = get_front_page_template())) {
} elseif (is_home() && ($template = get_home_template())) {
} elseif (is_attachment() && ($template = get_attachment_template())) {
remove_filter('the_content', 'prepend_attachment');
} elseif (is_single() && ($template = get_single_template())) {
} elseif (is_page() && ($template = get_page_template())) {
} elseif (is_category() && ($template = get_category_template())) {
} elseif (is_tag() && ($template = get_tag_template())) {
} elseif (is_author() && ($template = get_author_template())) {
} elseif (is_date() && ($template = get_date_template())) {
} elseif (is_archive() && ($template = get_archive_template())) {
} elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
} elseif (is_paged() && ($template = get_paged_template())) {
} else {
$template = get_index_template();
}
if ($template = apply_filters('template_include', $template)) {
ob_start();
include $template;
$contents = ob_get_contents();
ob_end_clean();
return $contents;
} else {
return;
}
}
开发者ID:dayax,项目名称:wordpress-test,代码行数:32,代码来源:Client.php
示例17: template_include_override
/**
* Rewrite all scripts to index.php of the theme
*
* @param string $template Template that is being loaded.
*
* @return mixed
*/
public static function template_include_override($template)
{
/**
* Only apply if theme uses Stencil
*/
$theme = Stencil_Environment::filter('require', false);
if (false !== $theme) {
/**
* Make it optional with default disabled
*/
$force = Stencil_Environment::filter('template_index_only', false);
if ($force) {
return get_index_template();
}
}
return $template;
}
开发者ID:moorscode,项目名称:stencil,代码行数:24,代码来源:stencil.php
示例18: getDefaultTemplate
/**
* @DEPRICATED
*/
public function getDefaultTemplate($post)
{
if ($post->post_status == 'auto-draft') {
return false;
}
$args = array('p' => $post->ID, 'post_type' => $post->post_type);
if ($post->post_type == 'page') {
$args = array('page_id' => $post->ID);
}
$template = false;
if (is_404() && ($template = get_404_template())) {
} elseif (is_search() && ($template = get_search_template())) {
} elseif (is_tax() && ($template = get_taxonomy_template())) {
} elseif (is_front_page() && ($template = get_front_page_template())) {
} elseif (is_home() && ($template = get_home_template())) {
} elseif (is_attachment() && ($template = get_attachment_template())) {
} elseif (is_single() && ($template = get_single_template())) {
} elseif (is_page() && ($template = get_page_template())) {
} elseif (is_category() && ($template = get_category_template())) {
} elseif (is_tag() && ($template = get_tag_template())) {
} elseif (is_author() && ($template = get_author_template())) {
} elseif (is_date() && ($template = get_date_template())) {
} elseif (is_archive() && ($template = get_archive_template())) {
} elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
} elseif (is_paged() && ($template = get_paged_template())) {
} else {
$template = get_index_template();
}
// wp_reset_query();
if ($template && is_file($template)) {
$template = basename($template);
} else {
$template = false;
}
return $template;
}
开发者ID:nikolaskarica,项目名称:bds-alliance,代码行数:39,代码来源:gumm_template_builder.php
示例19: elseif
} elseif (is_search() && ($template = get_search_template())) {
} elseif (is_front_page() && ($template = get_front_page_template())) {
} elseif (is_home() && ($template = get_home_template())) {
} elseif (is_post_type_archive() && ($template = get_post_type_archive_template())) {
} elseif (is_tax() && ($template = get_taxonomy_template())) {
} elseif (is_attachment() && ($template = get_attachment_template())) {
remove_filter('the_content', 'prepend_attachment');
} elseif (is_single() && ($template = get_single_template())) {
} elseif (is_page() && ($template = get_page_template())) {
} elseif (is_category() && ($template = get_category_template())) {
} elseif (is_tag() && ($template = get_tag_template())) {
} elseif (is_author() && ($template = get_author_template())) {
} elseif (is_date() && ($template = get_date_template())) {
} elseif (is_archive() && ($template = get_archive_template())) {
} elseif (is_comments_popup() && ($template = get_comments_popup_template())) {
} elseif (is_paged() && ($template = get_paged_template())) {
} else {
$template = get_index_template();
}
/**
* Filter the path of the current template before including it.
*
* @since 3.0.0
*
* @param string $template The path of the template to include.
*/
if ($template = apply_filters('template_include', $template)) {
include $template;
}
return;
}
开发者ID:Didox,项目名称:beminfinito,代码行数:31,代码来源:template-loader.php
示例20: aiowps_set_404
static function aiowps_set_404()
{
global $wp_query;
do_action('aiopws_before_set_404');
//This hook is for themes which produce a fatal error when the rename login feature is enabled and someone visits "wp-admin" slug directly
status_header(404);
$wp_query->set_404();
if ((($template = get_404_template()) || ($template = get_index_template())) && ($template = apply_filters('template_include', $template))) {
include $template;
}
die;
}
开发者ID:arobbins,项目名称:spellestate,代码行数:12,代码来源:wp-security-process-renamed-login-page.php
注:本文中的get_index_template函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论