• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_404_template函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_404_template函数的典型用法代码示例。如果您正苦于以下问题:PHP get_404_template函数的具体用法?PHP get_404_template怎么用?PHP get_404_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_404_template函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: 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


示例2: 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


示例3: throw404

 /**
  * Launch and display the 404 page depending upon the template
  *
  * @param   void
  * @return  void
  **/
 public function throw404()
 {
     // Change WP Query
     global $wp_query;
     $wp_query->set_404();
     status_header(404);
     // Disable that pesky Admin Bar
     add_filter('show_admin_bar', '__return_false', 900);
     remove_action('admin_footer', 'wp_admin_bar_render', 10);
     remove_action('wp_head', 'wp_admin_bar_header', 10);
     remove_action('wp_head', '_admin_bar_bump_cb', 10);
     wp_dequeue_script('admin-bar');
     wp_dequeue_style('admin-bar');
     // Template
     $four_tpl = apply_filters('LD_404', get_404_template());
     // Handle the admin bar
     @define('APP_REQUEST', TRUE);
     @define('DOING_AJAX', TRUE);
     if (empty($four_tpl) or !file_exists($four_tpl)) {
         // We're gonna try and get TwentyTen's one
         $twenty_ten_tpl = apply_filters('LD_404_FALLBACK', WP_CONTENT_DIR . '/themes/twentyfourteen/404.php');
         if (file_exists($twenty_ten_tpl)) {
             require $twenty_ten_tpl;
         } else {
             wp_die('404 - File not found!', '', array('response' => 404));
         }
     } else {
         // Their theme has a template!
         require $four_tpl;
     }
     // Either way, it's gonna stop right here.
     exit;
 }
开发者ID:estrategasdigitales,项目名称:glummer,代码行数:39,代码来源:Application.php


示例4: 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


示例5: 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


示例6: login_to_notfound

 static function login_to_notfound()
 {
     if (isset($_REQUEST['logout'])) {
         return;
     }
     if (preg_match('/wp-login.php/', $_SERVER['REQUEST_URI'])) {
         if ($_REQUEST['action'] == 'register' || $_REQUEST['action'] == 'login') {
             $template = get_404_template();
             include $template;
             exit;
         }
     }
 }
开发者ID:papikay,项目名称:PopUp-Login-and-Register,代码行数:13,代码来源:registration-login-control.php


示例7: init

 /**
  * Sets a 404 error for wp-login.php if it's disabled
  *
  * @since 6.3
  * @access public
  */
 public function init()
 {
     global $wp_query, $pagenow;
     if ('wp-login.php' == $pagenow && $this->get_option('private_login')) {
         $pagenow = 'index.php';
         $wp_query->set_404();
         status_header(404);
         nocache_headers();
         if (!($template = get_404_template())) {
             $template = 'index.php';
         }
         include $template;
         exit;
     }
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:21,代码来源:security.php


示例8: jr_security_check

/**
 * Function to prevent visitors without admin permissions
 * to access the wordpress backend. If you wish to permit
 * others besides admins acces, change the user_level
 * to a different number.
 *
 * http://codex.wordpress.org/Roles_and_Capabilities#level_8
 *
 * @global <type> $user_level
 *
 * in order to use this for wpmu, you need to follow the comment
 * instructions below in all locations and make the changes
 */
function jr_security_check()
{
    $jr_access_level = get_option('jr_admin_security');
    if (!isset($jr_access_level) || $jr_access_level == '') {
        $jr_access_level = 'read';
    }
    // if there's no value then give everyone access
    if (!current_user_can($jr_access_level)) {
        // comment out the above two lines and uncomment this line if you are using
        // wpmu and want to block back office access to everyone except admins
        // if (!is_site_admin()) {
        status_header(404);
        nocache_headers();
        include get_404_template();
        exit;
    }
}
开发者ID:besimhu,项目名称:legacy,代码行数:30,代码来源:theme-security.php


示例9: store_template

 /**
  * Include store template
  *
  * @param type $template
  * @return string
  */
 function store_template($template)
 {
     $store_name = get_query_var('store');
     if (!empty($store_name)) {
         $store_user = get_user_by('slug', $store_name);
         // no user found
         if (!$store_user) {
             return get_404_template();
         }
         // check if the user is seller
         if (!dokan_is_user_seller($store_user->ID)) {
             return get_404_template();
         }
         $templates = array("store-{$store_name}.php", 'store.php');
         return get_query_template('store', $templates);
     }
     return $template;
 }
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:24,代码来源:rewrites.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 = 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) && 'day' != $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');
     }
     // if this is an oembed, override the wrapping template and use the embed template
     if (Tribe__Templates::is_embed()) {
         $template = self::getTemplateHierarchy('embed');
     }
     self::$template = $template;
     return $template;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:51,代码来源:Templates.php


示例11: colabs_security_check

/**
 * Function to prevent visitors without admin permissions
 * to access the wordpress backend. If you wish to permit
 * others besides admins acces, change the user_level
 * to a different number.
 *
 * http://codex.wordpress.org/Roles_and_Capabilities#level_8
 *
 * @global <type> $user_level
 *
 * in order to use this for wpmu, you need to follow the comment
 * instructions below in all locations and make the changes
 */
function colabs_security_check()
{
    // secure the backend for non ajax calls
    if (isset($_SERVER['SCRIPT_NAME']) && basename($_SERVER['SCRIPT_NAME']) != 'admin-ajax.php') {
        $colabs_access_level = get_option('colabs_admin_security');
    }
    if (!isset($colabs_access_level) || $colabs_access_level == '') {
        $colabs_access_level = 'read';
    }
    // if there's no value then give everyone access
    if (is_user_logged_in() && !current_user_can($colabs_access_level)) {
        // comment out the above two lines and uncomment this line if you are using
        // wpmu and want to block back office access to everyone except admins
        // if (!is_site_admin()) {
        status_header(404);
        nocache_headers();
        include get_404_template();
        exit;
    }
}
开发者ID:nickwoodland,项目名称:easysitges,代码行数:33,代码来源:theme-security.php


示例12: set_error_404

/**
 * Load the 404 Not Found error page and display it (optional)
 *
 * @param bool $redirect Redirect browser to the page?
 * @param bool $display Display the page?
 * @since WP_Basic_Bootstrap 1.0
 */
function set_error_404($redirect = true, $display = false)
{
    /* @var $wp_query \WP_Query */
    global $wp_query;
    $wp_query->set_404();
    $status = basicbootstrap_get_status();
    if ($redirect && $status != 404) {
        wp_redirect(site_url('?error=404'));
    } elseif ($display) {
        status_header(404);
        nocache_headers();
        $tpl = get_404_template();
        if (!empty($tpl)) {
            include $tpl;
        } else {
            echo '<p>Page not found!</p>';
        }
        exit;
    }
}
开发者ID:e-picas,项目名称:wp-basic-bootstrap,代码行数:27,代码来源:error-pages.php


示例13: 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


示例14: 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


示例15: 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


示例16: templateLoad

 public function templateLoad($defaultView = '')
 {
     global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
     $content = '';
     /**
      * Loads the correct template based on the visitor's url
      * @package WordPress
      */
     if (defined('WP_USE_THEMES') && WP_USE_THEMES) {
         do_action('template_redirect');
     }
     /**
      * Filter whether to allow 'HEAD' requests to generate content.
      *
      * Provides a significant performance bump by exiting before the page
      * content loads for 'HEAD' requests. See #14348.
      *
      * @since 3.5.0
      *
      * @param bool $exit Whether to exit without generating any content for 'HEAD' requests. Default true.
      */
     if ('HEAD' === $_SERVER['REQUEST_METHOD'] && apply_filters('exit_on_http_head', true)) {
         exit;
     }
     // Process feeds and trackbacks even if not using themes.
     if (is_robots()) {
         /**
          * Fired when the template loader determines a robots.txt request.
          *
          * @since 2.1.0
          */
         do_action('do_robots');
         return $content;
     } elseif (is_feed()) {
         do_feed();
         return $content;
     } elseif (is_trackback()) {
         include ABSPATH . 'wp-trackback.php';
         return $content;
     }
     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_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', $this->defaultView ?: $template)) {
             load_template($template, false);
         }
         return $content;
     }
 }
开发者ID:ycms,项目名称:module-main,代码行数:75,代码来源:MainController.php


示例17: die_404

 /**
  * Ends the request with a 404 (Not Found) HTTP status code. Loads the 404 template if it exists.
  */
 private static function die_404()
 {
     global $wp_query;
     status_header(404);
     $wp_query->set_404();
     $template_path = get_404_template();
     if (file_exists($template_path)) {
         require_once $template_path;
     }
     die;
 }
开发者ID:nickwoodland,项目名称:easysitges,代码行数:14,代码来源:class-gf-download.php


示例18: aiowps_set_404

 static function aiowps_set_404()
 {
     global $wp_query;
     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:Rudchyk,项目名称:wp-framework,代码行数:10,代码来源:wp-security-process-renamed-login-page.php


示例19: test_switch_theme

 /**
  * @expectedDeprecated get_themes
  * @expectedDeprecated get_current_theme
  */
 function test_switch_theme()
 {
     $themes = get_themes();
     // Switch to each theme in sequence.
     // Do it twice to make sure we switch to the first theme, even if it's our starting theme.
     // Do it a third time to ensure switch_theme() works with one argument.
     for ($i = 0; $i < 3; $i++) {
         foreach ($themes as $name => $theme) {
             // switch to this theme
             if ($i === 2) {
                 switch_theme($theme['Template'], $theme['Stylesheet']);
             } else {
                 switch_theme($theme['Stylesheet']);
             }
             $this->assertEquals($name, get_current_theme());
             // make sure the various get_* functions return the correct values
             $this->assertEquals($theme['Template'], get_template());
             $this->assertEquals($theme['Stylesheet'], get_stylesheet());
             $root_fs = get_theme_root();
             $this->assertTrue(is_dir($root_fs));
             $root_uri = get_theme_root_uri();
             $this->assertTrue(!empty($root_uri));
             $this->assertEquals($root_fs . '/' . get_stylesheet(), get_stylesheet_directory());
             $this->assertEquals($root_uri . '/' . get_stylesheet(), get_stylesheet_directory_uri());
             $this->assertEquals($root_uri . '/' . get_stylesheet() . '/style.css', get_stylesheet_uri());
             #				$this->assertEquals($root_uri . '/' . get_stylesheet(), get_locale_stylesheet_uri());
             $this->assertEquals($root_fs . '/' . get_template(), get_template_directory());
             $this->assertEquals($root_uri . '/' . get_template(), get_template_directory_uri());
             //get_query_template
             // template file that doesn't exist
             $this->assertEquals('', get_query_template(rand_str()));
             // template files that do exist
             //foreach ($theme['Template Files'] as $path) {
             //$file = basename($path, '.php');
             // FIXME: untestable because get_query_template uses TEMPLATEPATH
             //$this->assertEquals('', get_query_template($file));
             //}
             // these are kind of tautologies but at least exercise the code
             $this->assertEquals(get_404_template(), get_query_template('404'));
             $this->assertEquals(get_archive_template(), get_query_template('archive'));
             $this->assertEquals(get_author_template(), get_query_template('author'));
             $this->assertEquals(get_category_template(), get_query_template('category'));
             $this->assertEquals(get_date_template(), get_query_template('date'));
             $this->assertEquals(get_home_template(), get_query_template('home', array('home.php', 'index.php')));
             $this->assertEquals(get_page_template(), get_query_template('page'));
             $this->assertEquals(get_paged_template(), get_query_template('paged'));
             $this->assertEquals(get_search_template(), get_query_template('search'));
             $this->assertEquals(get_single_template(), get_query_template('single'));
             $this->assertEquals(get_attachment_template(), get_query_template('attachment'));
             // this one doesn't behave like the others
             if (get_query_template('comments-popup')) {
                 $this->assertEquals(get_comments_popup_template(), get_query_template('comments-popup'));
             } else {
                 $this->assertEquals(get_comments_popup_template(), ABSPATH . 'wp-includes/theme-compat/comments-popup.php');
             }
             $this->assertEquals(get_tag_template(), get_query_template('tag'));
             // nb: this probably doesn't run because WP_INSTALLING is defined
             $this->assertTrue(validate_current_theme());
         }
     }
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:65,代码来源:theme.php


示例20: getTemplateHierarchy

 /**
  * Loads theme files in appropriate hierarchy: 1) child theme,
  * 2) parent template, 3) plugin resources. will look in the events/
  * directory in a theme and the views/ directory in the plugin
  *
  * @param string $template template file to search for
  * @param array $args additional arguments to affect the template path
  *  - subfolder
  *  - namespace
  *  - plugin_path
  *  - disable_view_check - bypass the check to see if the view is enabled
  * @return template path
  * @author Matt Wiebe
  **/
 public static function getTemplateHierarchy($template, $args = array())
 {
     if (!is_array($args)) {
         $args = array();
         $passed = func_get_args();
         $backwards_map = array('subfolder', 'namespace', 'plugin_path');
         if (count($passed > 1)) {
             for ($i = 1; $i < count($passed); $i++) {
                 $args[$backwards_map[$i - 1]] = $passed[$i];
             }
         }
     }
     $args = wp_parse_args($args, array('subfolder' => '', 'namespace' => '/', 'plugin_path' => '', 'disable_view_check' => false));
     /**
      * @var string $subfolder
      * @var string $namespace
      * @var string $pluginpath
      * @var bool $disable_view_check
      */
     extract($args);
     $tec = TribeEvents::instance();
     if (substr($template, -4) != '.php') {
         $template .= '.php';
     }
     // setup the meta definitions
     require_once $tec->pluginPath . 'public/advanced-functions/meta.php';
     // Allow base path for templates to be filtered
     $template_base_paths = apply_filters('tribe_events_template_paths', (array) TribeEvents::instance()->pluginPath);
     // backwards compatibility if $plugin_path arg is used
     if ($plugin_path && !in_array($plugin_path, $template_base_paths)) {
         $template_base_paths[] = $plugin_path;
     }
     // ensure that addon plugins look in the right override folder in theme
     $namespace = !empty($namespace) && $namespace[0] != '/' ? '/' . trailingslashit($namespace) : trailingslashit($namespace);
     // setup subfolder options
     $subfolder = !empty($subfolder) ? trailingslashit($subfolder) : $subfolder;
     $file = '';
     foreach ($template_base_paths as $template_base_path) {
         if ($theme_file = locate_template(array('tribe-events' . $namespace . $subfolder . $template), false, false)) {
             $file = $theme_file;
         } else {
             // protect from concat folder with filename
             $subfolder = empty($subfolder) ? trailingslashit($subfolder) : $subfolder;
             $subfolder = $subfolder[0] != '/' ? '/' . $subfolder : $subfolder;
             $file = $template_base_path . 'views' . $subfolder . $template;
             // echo $file;
         }
         if (!$disable_view_check && in_array($tec->displaying, tribe_events_disabled_views())) {
             $file = get_404_template();
         }
         $file = apply_filters('tribe_events_template', $file, $template);
         // return the first one found
         if (file_exists($file)) {
             break;
         }
     }
     return apply_filters('tribe_events_template_' . $template, $file);
 }
开发者ID:TyRichards,项目名称:river_of_life,代码行数:72,代码来源:tribe-templates.class.php



注:本文中的get_404_template函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_AJAX_constructor函数代码示例发布时间:2022-05-15
下一篇:
PHP getZonesTypes函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap