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


PHP WP_Theme::display方法代码示例

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


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

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

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

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

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

示例5: get_theme_update_available

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return false|string HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!$theme instanceof WP_Theme) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        $update_onclick = 'onclick="if ( confirm(\'' . esc_js(__("Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.")) . '\') ) {return true;}return false;"';
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version']);
            } elseif (empty($update['package'])) {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version']);
            } else {
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.') . '</strong></p>', $theme_name, esc_url($details_url), esc_attr($theme['Name']), $update['new_version'], $update_url, $update_onclick);
            }
        }
    }
    return $html;
}
开发者ID:ycms,项目名称:wp-core,代码行数:43,代码来源:theme.php

示例6:

 /**
  * @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

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

示例8: get_theme_update_available

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @staticvar object $themes_update
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return false|string HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update = null;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!$theme instanceof WP_Theme) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        if (!is_multisite()) {
            if (!current_user_can('update_themes')) {
                /* translators: 1: theme name, 2: theme details URL, 3: additional link attributes, 4: version number */
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.') . '</strong></p>', $theme_name, esc_url($details_url), sprintf('class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))), $update['new_version']);
            } elseif (empty($update['package'])) {
                /* translators: 1: theme name, 2: theme details URL, 3: additional link attributes, 4: version number */
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>', $theme_name, esc_url($details_url), sprintf('class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))), $update['new_version']);
            } else {
                /* translators: 1: theme name, 2: theme details URL, 3: additional link attributes, 4: version number, 5: update URL, 6: additional link attributes */
                $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.') . '</strong></p>', $theme_name, esc_url($details_url), sprintf('class="thickbox open-plugin-details-modal" aria-label="%s"', esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version']))), $update['new_version'], $update_url, sprintf('aria-label="%s" id="update-theme" data-slug="%s"', esc_attr(sprintf(__('Update %s now'), $theme_name)), $stylesheet));
            }
        }
    }
    return $html;
}
开发者ID:johnpbloch,项目名称:wordpress,代码行数:47,代码来源:theme.php

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

示例10: 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->display('Author', false, false));
    return $theme_data;
}
开发者ID:nunomorgadinho,项目名称:WordPress,代码行数:18,代码来源:deprecated.php

示例11: get_theme_update_available

/**
 * Retrieve the update link if there is a theme update available.
 *
 * Will return a link if there is an update available.
 *
 * @since 3.8.0
 *
 * @staticvar object $themes_update
 *
 * @param WP_Theme $theme WP_Theme object.
 * @return false|string HTML for the update link, or false if invalid info was passed.
 */
function get_theme_update_available($theme)
{
    static $themes_update = null;
    if (!current_user_can('update_themes')) {
        return false;
    }
    if (!isset($themes_update)) {
        $themes_update = get_site_transient('update_themes');
    }
    if (!$theme instanceof WP_Theme) {
        return false;
    }
    $stylesheet = $theme->get_stylesheet();
    $html = '';
    if (isset($themes_update->response[$stylesheet])) {
        $update = $themes_update->response[$stylesheet];
        $theme_name = $theme->display('Name');
        $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
        //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list.
        $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&amp;theme=' . urlencode($stylesheet)), 'upgrade-theme_' . $stylesheet);
        if (!current_user_can('update_themes')) {
            /* translators: 1: theme name, 2: theme details URL, 3: theme version number */
            $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox">View version %3$s details</a>.') . '</strong></p>', $theme_name, esc_url($details_url), $update['new_version']);
        } elseif (empty($update['package'])) {
            /* translators: 1: theme name, 2: theme details URL, 3: theme version number */
            $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox">View version %3$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>', $theme_name, esc_url($details_url), $update['new_version']);
        } else {
            /* translators: 1: theme name, 2: theme details URL, 3: theme version number, 4: theme update URL */
            $html = sprintf('<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox">View version %3$s details</a> or <a href="%4$s">update now</a>.') . '</strong></p>', $theme_name, esc_url($details_url), $update['new_version'], $update_url);
        }
    }
    return $html;
}
开发者ID:7press,项目名称:7press,代码行数:45,代码来源:theme.php


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