當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WP_Theme::get_template方法代碼示例

本文整理匯總了PHP中WP_Theme::get_template方法的典型用法代碼示例。如果您正苦於以下問題:PHP WP_Theme::get_template方法的具體用法?PHP WP_Theme::get_template怎麽用?PHP WP_Theme::get_template使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WP_Theme的用法示例。


在下文中一共展示了WP_Theme::get_template方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: twentythirteen_switch_theme

/**
 * Prevent switching to Twenty Thirteen on old versions of WordPress. Switches
 * to the previously activated theme or the default theme.
 *
 * @since Twenty Thirteen 1.0
 *
 * @param string $theme_name The theme name.
 * @param WP_Theme $theme The theme object.
 * @return void
 */
function twentythirteen_switch_theme($theme_name, $theme)
{
    if ('twentythirteen' != $theme->get_template()) {
        switch_theme($theme->get_template(), $theme->get_stylesheet());
    } elseif ('twentythirteen' != WP_DEFAULT_THEME) {
        switch_theme(WP_DEFAULT_THEME);
    }
    unset($_GET['activated']);
    add_action('admin_notices', 'twentythirteen_upgrade_notice');
}
開發者ID:ninnypants,項目名稱:WordPress,代碼行數:20,代碼來源:back-compat.php

示例2: search_theme

 /**
  * @param WP_Theme $theme
  * @return bool
  */
 public function search_theme($theme)
 {
     // Search the features
     foreach ($this->features as $word) {
         if (!in_array($word, $theme->get('Tags'))) {
             return false;
         }
     }
     // Match all phrases
     foreach ($this->search_terms as $word) {
         if (in_array($word, $theme->get('Tags'))) {
             continue;
         }
         foreach (array('Name', 'Description', 'Author', 'AuthorURI') as $header) {
             // Don't mark up; Do translate.
             if (false !== stripos(strip_tags($theme->display($header, false, true)), $word)) {
                 continue 2;
             }
         }
         if (false !== stripos($theme->get_stylesheet(), $word)) {
             continue;
         }
         if (false !== stripos($theme->get_template(), $word)) {
             continue;
         }
         return false;
     }
     return true;
 }
開發者ID:RA2WP,項目名稱:RA2WP,代碼行數:33,代碼來源:class-wp-themes-list-table.php

示例3:

 /**
  * @ticket 20313
  */
 function test_new_WP_Theme_subdir_bad_root()
 {
     // This is what get_theme_data() does when you pass it a style.css file for a theme in a subdir.
     $theme = new WP_Theme('theme2', $this->theme_root . '/subdir');
     //Meta
     $this->assertEquals('My Subdir Theme', $theme->get('Name'));
     $this->assertEquals('http://example.org/', $theme->get('ThemeURI'));
     $this->assertEquals('An example theme in a sub directory', $theme->get('Description'));
     $this->assertEquals('Mr. WordPress', $theme->get('Author'));
     $this->assertEquals('http://wordpress.org/', $theme->get('AuthorURI'));
     $this->assertEquals('0.1', $theme->get('Version'));
     $this->assertEquals('', $theme->get('Template'));
     $this->assertEquals('publish', $theme->get('Status'));
     $this->assertEquals(array(), $theme->get('Tags'));
     //Important
     $this->assertEquals('subdir/theme2', $theme->get_stylesheet());
     $this->assertEquals('subdir/theme2', $theme->get_template());
 }
開發者ID:atimmer,項目名稱:wordpress-develop-mirror,代碼行數:21,代碼來源:WPTheme.php

示例4: _search_callback

 /**
  * @staticvar string $term
  * @param WP_Theme $theme
  * @return bool
  */
 public function _search_callback($theme)
 {
     static $term;
     if (is_null($term)) {
         $term = wp_unslash($_REQUEST['s']);
     }
     foreach (array('Name', 'Description', 'Author', 'Author', 'AuthorURI') as $field) {
         // Don't mark up; Do translate.
         if (false !== stripos($theme->display($field, false, true), $term)) {
             return true;
         }
     }
     if (false !== stripos($theme->get_stylesheet(), $term)) {
         return true;
     }
     if (false !== stripos($theme->get_template(), $term)) {
         return true;
     }
     return false;
 }
開發者ID:taherbth,項目名稱:bestbuy-bestsell,代碼行數:25,代碼來源:MPSUM_Themes_List_Table.php


注:本文中的WP_Theme::get_template方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。