当前位置: 首页>>代码示例>>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;未经允许,请勿转载。