当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Theme::get方法代码示例

本文整理汇总了PHP中WP_Theme::get方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Theme::get方法的具体用法?PHP WP_Theme::get怎么用?PHP WP_Theme::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Theme的用法示例。


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

示例1: 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:kadrim1,项目名称:metsayhistu,代码行数:33,代码来源:class-wp-themes-list-table.php

示例2: get_theme_field

 /**
  * Returns field from theme data if cookie is set to valid theme.
  *
  * @param string $field_name
  * @param mixed  $default
  *
  * @deprecated :2.0
  *
  * @return mixed
  */
 public static function get_theme_field($field_name, $default = false)
 {
     if (!empty(self::$theme)) {
         return self::$theme->get($field_name);
     }
     return $default;
 }
开发者ID:rarst,项目名称:toolbar-theme-switcher,代码行数:17,代码来源:Toolbar_Theme_Switcher.php

示例3: get_theme_info_html

    protected function get_theme_info_html(WP_Theme $theme)
    {
        $name = $theme->display('Name');
        $version = $theme->display('Version');
        $description = $theme->display('Description');
        $desc_title = esc_attr($theme->get('Description'));
        $author = $theme->display('Author');
        $screenshot = $theme->get_screenshot();
        $thumbnail_style = $screenshot !== false ? sprintf('style="background-image:url(%s);"', $screenshot) : '';
        $theme_url = network_admin_url(add_query_arg('theme', $theme->get_stylesheet(), 'themes.php'));
        $version_label = __('Version:', 'wtaiu');
        $author_label = __('By', 'wtaiu');
        $output = <<<OUTPUT

<div class="theme-info" title="{$desc_title}">
    <a href="{$theme_url}" class="theme-screenshot" {$thumbnail_style}></a>
    <div class="theme-info-wrap">
        <h3 class="theme-info-header" title="{$name}">
            <a href="{$theme_url}" class="theme-name">{$name}</a>
        </h3>
        <p class="theme-version">{$version_label} {$version}</p>
        <p class="theme-author">{$author_label} {$author}</p>
    </div>
</div>

OUTPUT;
        return $output;
    }
开发者ID:webdeveric,项目名称:what-template-am-i-using,代码行数:28,代码来源:core-panels.php

示例4: __construct

 /**
  * Constructor.
  *
  * @param string $store_url  This is the URL to your store.
  * @param int    $product_id This is the product ID of your plugin.
  * @param array  $args       Additional args.
  *
  * @throws Exception
  */
 public function __construct($store_url, $product_id, $args = array())
 {
     $this->store_url = trailingslashit($store_url);
     $this->product_id = $product_id;
     $this->theme = wp_get_theme();
     if (empty($args['version'])) {
         $this->version = $this->theme->get('Version');
     } else {
         $this->version = $args['version'];
     }
     if ($args['key']) {
         $this->key = $args['key'];
     }
     if ($args['activation_id']) {
         $this->id = absint($args['activation_id']);
     }
     add_filter('pre_set_site_transient_update_themes', array($this, 'check_for_update'));
     add_action("in_theme_update_message-{$this->theme->get_stylesheet()}", array($this, 'show_upgrade_notice_on_list'), 10, 2);
 }
开发者ID:pemiu01,项目名称:itelic-theme-updater,代码行数:28,代码来源:itelic-theme-updater.php

示例5:

 /**
  * Returns the version of the the current theme.
  * 
  * @return string
  *   The version of the current theme.
  * 
  * @ingroup helperfunc
  */
 function get_theme_version()
 {
     if (class_exists('WP_Theme')) {
         $theme = new WP_Theme(get_theme_name(), get_theme_root());
         return $theme->get('Version');
     } else {
         $theme_data = get_theme_data(get_template_directory() . '/style.css');
         return $theme_data['Version'];
     }
 }
开发者ID:AnnaNee,项目名称:wordless,代码行数:18,代码来源:theme_helper.php

示例6: resolveLanguagesPath

 public static function resolveLanguagesPath(\WP_Theme $theme)
 {
     // as taken from wp-includes/class-wp-theme.php:1114
     $path = $theme->get_stylesheet_directory();
     if ($domainpath = $theme->get('DomainPath')) {
         $path .= $domainpath;
     } else {
         $path .= '/languages';
     }
     return $path;
 }
开发者ID:sourcerer-mike,项目名称:wp-easy-translate,代码行数:11,代码来源:WpTheme.php

示例7:

 /**
  * @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:rmccue,项目名称:wordpress-unit-tests,代码行数:21,代码来源:WPTheme.php

示例8: get_theme_data

/**
 * Retrieve theme data from parsed theme file.
 *
 * @since 1.5.0
 * @deprecated 3.4.0
 * @deprecated Use wp_get_theme()
 * @see wp_get_theme()
 *
 * @param string $theme_file Theme file path.
 * @return array Theme data.
 */
function get_theme_data($theme_file)
{
    _deprecated_function(__FUNCTION__, '3.4', 'wp_get_theme()');
    $theme = new WP_Theme(basename(dirname($theme_file)), dirname(dirname($theme_file)));
    $theme_data = array('Name' => $theme->get('Name'), 'URI' => $theme->display('ThemeURI', true, false), 'Description' => $theme->display('Description', true, false), 'Author' => $theme->display('Author', true, false), 'AuthorURI' => $theme->display('AuthorURI', true, false), 'Version' => $theme->get('Version'), 'Template' => $theme->get('Template'), 'Status' => $theme->get('Status'), 'Tags' => $theme->get('Tags'), 'Title' => $theme->get('Name'), 'AuthorName' => $theme->get('Author'));
    foreach (apply_filters('extra_theme_headers', array()) as $extra_header) {
        if (!isset($theme_data[$extra_header])) {
            $theme_data[$extra_header] = $theme->get($extra_header);
        }
    }
    return $theme_data;
}
开发者ID:rkglug,项目名称:WordPress,代码行数:23,代码来源:deprecated.php

示例9: offsetGet

 /**
  * Method to implement ArrayAccess for keys formerly returned by get_themes()
  */
 public function offsetGet($offset)
 {
     switch ($offset) {
         case 'Name':
         case 'Version':
         case 'Status':
             return $this->get($offset);
         case 'Title':
             return $this->get('Name');
             // Author, Author Name, Author URI, and Description did not
             // previously return translated data. We are doing so now.
             // Title and Name could have been used as the key for get_themes(),
             // so both to remain untranslated for back compatibility.
         // Author, Author Name, Author URI, and Description did not
         // previously return translated data. We are doing so now.
         // Title and Name could have been used as the key for get_themes(),
         // so both to remain untranslated for back compatibility.
         case 'Author':
             return $this->display('Author');
         case 'Author Name':
             return $this->display('Author', false);
         case 'Author URI':
             return $this->display('AuthorURI');
         case 'Description':
             return $this->display('Description');
         case 'Template':
             return $this->get_template();
         case 'Stylesheet':
             return $this->get_stylesheet();
         case 'Template Files':
             $files = $this->get_files('php');
             foreach ($files as &$file) {
                 $file = $this->theme_root . '/' . $file;
             }
             return $files;
         case 'Stylesheet Files':
             $files = $this->get_files('css');
             foreach ($files as &$file) {
                 $file = $this->theme_root . '/' . $file;
             }
             return $files;
         case 'Template Dir':
             return $this->get_template_directory();
         case 'Stylesheet Dir':
             return $this->get_stylesheet_directory();
         case 'Screenshot':
             return $this->get_screenshot('relative');
         case 'Tags':
             return $this->get('Tags');
         case 'Theme Root':
             return $this->get_theme_root();
         case 'Theme Root URI':
             return $this->get_theme_root_uri();
         case 'Parent Theme':
             return $this->parent ? $this->parent->get('Name') : '';
         default:
             return null;
     }
 }
开发者ID:netconstructor,项目名称:WordPress-1,代码行数:62,代码来源:class-wp-theme.php

示例10:

 /**
  * @ticket 26873
  */
 function test_display_method_on_get_method_failure()
 {
     $theme = new WP_Theme('nonexistent', $this->theme_root);
     $this->assertEquals('nonexistent', $theme->get('Name'));
     $this->assertFalse($theme->get('AuthorURI'));
     $this->assertFalse($theme->get('Tags'));
     $this->assertFalse($theme->display('Tags'));
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:11,代码来源:WPTheme.php

示例11: tc_get_theme_data

function tc_get_theme_data($theme_file)
{
    if (!class_exists('WP_Theme')) {
        return get_theme_data($theme_file);
    }
    $theme = new WP_Theme(basename(dirname($theme_file)), dirname(dirname($theme_file)));
    $theme_data = array('Name' => $theme->get('Name'), 'URI' => $theme->display('ThemeURI', true, false), 'Description' => $theme->display('Description', true, false), 'Author' => $theme->display('Author', true, false), 'AuthorURI' => $theme->display('AuthorURI', true, false), 'Version' => $theme->get('Version'), 'Template' => $theme->get('Template'), 'Status' => $theme->get('Status'), 'Tags' => $theme->get('Tags'), 'Title' => $theme->get('Name'), 'AuthorName' => $theme->display('Author', false, false), 'License' => $theme->display('License', false, false), 'License URI' => $theme->display('License URI', false, false), 'Template Version' => $theme->display('Template Version', false, false));
    return $theme_data;
}
开发者ID:shufschmid,项目名称:baselcitykubb,代码行数:9,代码来源:checkbase.php

示例12: _init

 /**
  * Do a several Clean Up
  *
  * @brief Clean Up
  */
 public function _init()
 {
     /* Text Domain */
     if ($this->setup->autoload_text_domain) {
         load_theme_textdomain($this->theme->get('TextDomain'), trailingslashit(TEMPLATEPATH) . $this->theme->get('DomainPath'));
     }
     /* Clean up wp_head */
     if ($this->setup->cleanup_wp_head) {
         remove_action('wp_head', 'feed_links_extra', 3);
         // Category Feeds
         remove_action('wp_head', 'feed_links', 2);
         // Post and Comment Feeds
         remove_action('wp_head', 'rsd_link');
         // EditURI link
         remove_action('wp_head', 'wlwmanifest_link');
         // Windows Live Writer
         remove_action('wp_head', 'index_rel_link');
         // index link
         remove_action('wp_head', 'parent_post_rel_link', 10, 0);
         // previous link
         remove_action('wp_head', 'start_post_rel_link', 10, 0);
         // start link
         remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
         // Links for Adjacent Posts
         remove_action('wp_head', 'wp_generator');
         // WP vers
     }
 }
开发者ID:wpxtreme,项目名称:wpdk,代码行数:33,代码来源:wpdk-wordpress-theme.php

示例13: column_description

 /**
  * Handles the description column output.
  *
  * @since 4.3.0
  * @access public
  *
  * @global string $status
  * @global array  $totals
  *
  * @param WP_Theme $theme The current WP_Theme object.
  */
 public function column_description($theme)
 {
     global $status, $totals;
     if ($theme->errors()) {
         $pre = $status == 'broken' ? __('Broken Theme:') . ' ' : '';
         echo '<p><strong class="error-message">' . $pre . $theme->errors()->get_error_message() . '</strong></p>';
     }
     if ($this->is_site_themes) {
         $allowed = $theme->is_allowed('site', $this->site_id);
     } else {
         $allowed = $theme->is_allowed('network');
     }
     $class = !$allowed ? 'inactive' : 'active';
     if (!empty($totals['upgrade']) && !empty($theme->update)) {
         $class .= ' update';
     }
     echo "<div class='theme-description'><p>" . $theme->display('Description') . "</p></div>\n\t\t\t<div class='{$class} second theme-version-author-uri'>";
     $stylesheet = $theme->get_stylesheet();
     $theme_meta = array();
     if ($theme->get('Version')) {
         $theme_meta[] = sprintf(__('Version %s'), $theme->display('Version'));
     }
     $theme_meta[] = sprintf(__('By %s'), $theme->display('Author'));
     if ($theme->get('ThemeURI')) {
         $theme_meta[] = '<a href="' . $theme->display('ThemeURI') . '" title="' . esc_attr__('Visit theme homepage') . '">' . __('Visit Theme Site') . '</a>';
     }
     /**
      * Filter the array of row meta for each theme in the Multisite themes
      * list table.
      *
      * @since 3.1.0
      *
      * @param array    $theme_meta An array of the theme's metadata,
      *                             including the version, author, and
      *                             theme URI.
      * @param string   $stylesheet Directory name of the theme.
      * @param WP_Theme $theme      WP_Theme object.
      * @param string   $status     Status of the theme.
      */
     $theme_meta = apply_filters('theme_row_meta', $theme_meta, $stylesheet, $theme, $status);
     echo implode(' | ', $theme_meta);
     echo '</div>';
 }
开发者ID:alenteria,项目名称:vitrari,代码行数:54,代码来源:class-wp-ms-themes-list-table.php

示例14:

	/**
	 * If theme is in list of allowed to be switched to.
	 *
	 * @param WP_Theme $theme
	 *
	 * @return bool
	 */
	static function is_allowed( $theme ) {

		return array_key_exists( $theme->get( 'Name' ), self::get_allowed_themes() );
	}
开发者ID:polaris610,项目名称:medicalhound,代码行数:11,代码来源:ult-switcher.php

示例15: prepare_item_for_response

 /**
  * Prepare item for response
  *
  * @param WP_Theme $item
  * @param WP_REST_Request $request
  *
  * @return array
  */
 public function prepare_item_for_response($item, $request)
 {
     return array('name' => $item->get('Name'), 'slug' => $item->slug, 'version' => $item->get('Version'), 'description' => $item->get('Description'), 'author' => $item->get('Author'), 'author_uri' => $item->get('AuthorURI'), 'text_domain' => $item->get('TextDomain'), 'domain_path' => $item->get('DomainPath'), 'tags' => $item->get('Tags'));
 }
开发者ID:danbilauca,项目名称:wp-api-plugins-themes-endpoints,代码行数:12,代码来源:class-wp-rest-themes-controller.php


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