本文整理汇总了PHP中wp_get_theme函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_get_theme函数的具体用法?PHP wp_get_theme怎么用?PHP wp_get_theme使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_get_theme函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: siw_wc_checkout_scripts_js
function siw_wc_checkout_scripts_js()
{
wp_register_script('siw-wc-checkout-scripts', get_stylesheet_directory_uri() . '/assets/js/siw-wc-checkout-scripts.js', array('jquery'), wp_get_theme()->version, TRUE);
$site_url = site_url();
$parameters = array('ajax_url' => get_stylesheet_directory_uri() . '/siw-ajax.php');
wp_localize_script('siw-wc-checkout-scripts', 'parameters', $parameters);
}
开发者ID:siwvolunteers,项目名称:siw,代码行数:7,代码来源:siw-js-css.php
示例2: memberlite_update_themes_filter
/**
* Infuse theme update details when WordPress runs its update checker.
*
* @since 2.0
*
* @param object $value The WordPress update object.
* @return object $value Amended WordPress update object on success, default if object is empty.
*/
function memberlite_update_themes_filter($value)
{
// If no update object exists, return early.
if (empty($value)) {
return $value;
}
// get update_info information
$update_info = memberlite_getUpdateInfo();
// no info?
if (empty($update_info)) {
return $value;
}
//get data for theme
$theme_file_abs = ABSPATH . 'wp-content/themes/' . $update_info['Slug'];
$theme_file = $theme_file_abs . "/style.css";
$theme_data = wp_get_theme($update_info['Slug']);
//compare versions
if (!empty($update_info['License']) && version_compare($theme_data['Version'], $update_info['Version'], '<')) {
$value->response[$update_info['Slug']] = array('theme' => $update_info['Slug'], 'new_version' => $update_info['Version'], 'url' => $update_info['ThemeURI'], 'package' => $update_info['Download']);
//get license key if one is available
$key = get_option("pmpro_license_key", "");
if (!empty($key) && pmpro_license_isValid($key, "plus")) {
$value->response[$update_info['Slug']]['package'] = add_query_arg("key", $key, $value->response[$update_info['Slug']]['package']);
} else {
global $memberlite_license_error;
//only want to show this once
if (empty($memberlite_license_error)) {
$memberlite_license_error = true;
echo "<div class='error'><p>" . sprintf(__('A valid PMPro Plus license key is required to update Memberlite. <a href="%s">Please validate your PMPro Plus license key</a>.', 'memberlite'), admin_url('options-general.php?page=pmpro_license_settings')) . "</p></div>";
}
}
}
// Return the update object.
return $value;
}
开发者ID:greathmaster,项目名称:memberlite,代码行数:43,代码来源:updates.php
示例3: start_previewing_theme
/**
* Start previewing the selected theme.
*
* Adds filters to change the current theme.
*
* @since 3.4.0
*/
public function start_previewing_theme()
{
if ($this->is_preview() || false === $this->theme || $this->theme && !$this->theme->exists()) {
return;
}
// Initialize $theme and $original_stylesheet if they do not yet exist.
if (!isset($this->theme)) {
$this->theme = wp_get_theme($_REQUEST['theme']);
if (!$this->theme->exists()) {
$this->theme = false;
return;
}
}
$this->original_stylesheet = get_stylesheet();
$this->previewing = true;
add_filter('template', array($this, 'get_template'));
add_filter('stylesheet', array($this, 'get_stylesheet'));
add_filter('pre_option_current_theme', array($this, 'current_theme'));
// @link: http://core.trac.wordpress.org/ticket/20027
add_filter('pre_option_stylesheet', array($this, 'get_stylesheet'));
add_filter('pre_option_template', array($this, 'get_template'));
// Handle custom theme roots.
add_filter('pre_option_stylesheet_root', array($this, 'get_stylesheet_root'));
add_filter('pre_option_template_root', array($this, 'get_template_root'));
do_action('start_previewing_theme');
}
开发者ID:radman,项目名称:noobyo-blog,代码行数:33,代码来源:class-wp-customize.php
示例4: jbaths_scripts
/**
* Enqueue scripts and styles.
*/
function jbaths_scripts()
{
$theme = wp_get_theme();
// wtf
wp_enqueue_style('wtf-forms', get_template_directory_uri() . '/css/wtf-forms.css', array(), '2.2.0');
// and then
wp_enqueue_style('jbaths', get_stylesheet_uri(), array(), $theme->Version . '.1');
// store locator plus - specialty css
if (is_page('find-a-showroom')) {
wp_enqueue_style('jbaths-slp', get_template_directory_uri() . '/css/slp-baths.css', array(), $theme->Version);
// store locator plus
}
if (!is_admin()) {
wp_register_script('jbaths.modernizr', get_stylesheet_directory_uri() . '/js/modernizr.min.js', array(), '2.8.3', true);
wp_register_script('jquery.cookie', get_stylesheet_directory_uri() . '/js/jquery.cookie.js', array('jquery'), $theme->Version);
wp_register_script('scrollupforwhat', get_stylesheet_directory_uri() . '/js/jquery.scrollupforwhat.min.js', array('jquery'), '1.2', true);
wp_register_script('matchHeight', get_template_directory_uri() . '/js/jquery.matchHeight.js', array('jquery'), '0.5.2', true);
$jbaths_deps = array('jquery', 'jbaths.modernizr', 'jquery.cookie', 'scrollupforwhat', 'matchHeight');
if (is_singular('bathtubs') || is_singular('faucets')) {
if (get_option('ultimate_row') == "enable") {
//$jbaths_deps[] = 'ultimate-row-bg';
}
}
wp_enqueue_script('jbaths', get_template_directory_uri() . '/js/baths.js', $jbaths_deps, '20140718', true);
}
wp_enqueue_script('skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true);
// Omniture SiteCatalyst
wp_enqueue_script('sitecatalyst', get_template_directory_uri() . '/js/s_code.js', array(), $theme->Version, true);
if (is_singular('post') && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
}
开发者ID:jchristopher,项目名称:jbaths,代码行数:35,代码来源:functions.php
示例5: avada_child_scripts
function avada_child_scripts()
{
if (!is_admin() && !in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) {
$theme_info = wp_get_theme();
wp_enqueue_style('avada-child-stylesheet', get_template_directory_uri() . '/style.css', array(), $theme_info->get('Version'));
}
}
开发者ID:TheDraguun,项目名称:julitewoo,代码行数:7,代码来源:functions.php
示例6: display
function display()
{
$browser = new SendPress_Browser();
if (get_bloginfo('version') < '3.4') {
$theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
$theme = $theme_data['Name'] . ' ' . $theme_data['Version'];
} else {
$theme_data = wp_get_theme();
$theme = $theme_data->Name . ' ' . $theme_data->Version;
}
// Try to identify the hosting provider
$host = false;
if (defined('WPE_APIKEY')) {
$host = 'WP Engine';
} elseif (defined('PAGELYBIN')) {
$host = 'Pagely';
}
$request['cmd'] = '_notify-validate';
$params = array('sslverify' => false, 'timeout' => 60, 'body' => $request);
$response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params);
if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
$WP_REMOTE_POST = 'wp_remote_post() works' . "\n";
} else {
$WP_REMOTE_POST = 'wp_remote_post() does not work' . "\n";
}
return $this->display_output($browser, $theme, $host, $WP_REMOTE_POST);
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:27,代码来源:class-sendpress-view-help.php
示例7: register_meta_boxes
/**
* Add the various registered meta boxes.
* @access public
* @since 6.0.0
* @return void
*/
public function register_meta_boxes()
{
$defaults = array('id' => 'woothemes-settings', 'title' => sprintf(__('%s Settings', 'woothemes'), wp_get_theme()->__get('Name')), 'callback' => array($this, 'meta_box_content'), 'page' => 'all', 'context' => 'normal', 'priority' => 'default', 'callback_args' => '');
$settings = array('id' => 'woothemes-settings', 'title' => sprintf(__('%s Settings', 'woothemes'), wp_get_theme()->__get('Name')), 'callback' => array($this, 'meta_box_content'), 'page' => 'all', 'context' => 'normal', 'priority' => 'default', 'callback_args' => '');
// Allow child themes/plugins to filter these settings.
$settings = apply_filters('woothemes_metabox_settings', $settings, $settings['page'], $settings['id']);
$meta_boxes = array('woothemes-settings' => $settings);
$meta_boxes = (array) apply_filters('wf_meta_boxes', $meta_boxes);
// Loop through and set up the meta boxes.
if (0 < count($meta_boxes)) {
$global_boxes = array();
foreach ($meta_boxes as $k => $v) {
if (!isset($v['page'])) {
$meta_boxes[$k]['page'] = 'all';
}
// If we want this box to apply to all post types, store it for later to avoid doing a loop within a loop (nasty).
if ('all' == $v['page']) {
$global_boxes[$k] = $v;
} else {
$v = wp_parse_args($v, $defaults);
add_meta_box($v['id'], $v['title'], array($this, 'meta_box_content'), $v['page'], $v['context'], $v['priority'], $v['callback_args']);
}
}
// Maybe process global boxes.
if (0 < count($global_boxes)) {
foreach ($global_boxes as $k => $v) {
$v = wp_parse_args($v, $defaults);
foreach (get_post_types() as $i => $j) {
add_meta_box($v['id'], $v['title'], array($this, 'meta_box_content'), $j, $v['context'], $v['priority'], $v['callback_args']);
}
}
}
}
}
开发者ID:jonpalma,项目名称:bcc,代码行数:40,代码来源:class-wf-meta.php
示例8: constants
/**
* Define all of the constants for our theme, framework including
* version numbers, paths, etc.
*
* @author Richard Tape
* @package Incipio
* @since 1.0
* @param None
* @return None
*/
function constants()
{
//Define our framework version
define('INCIPIO_VERSION', '1.0');
//Define theme-related constants with support for WP < 3.4
if (function_exists('wp_get_theme')) {
//We're using WordPress version 3.4+
$theme_data = wp_get_theme();
if (!defined('THEMENAME')) {
define('THEMENAME', $theme_data->Template);
}
if (!defined('THEMEVERSION')) {
define('THEMEVERSION', $theme_data->Version);
}
} else {
//We're using WP < 3.4 so don't have access to the wp_get_theme class
$theme_data = get_theme_data(get_template_directory() . '/style.css');
if (!defined('THEMENAME')) {
define('THEMENAME', $theme_data['Template']);
}
if (!defined('THEMEVERSION')) {
define('THEMEVERSION', $theme_data['Version']);
}
}
}
开发者ID:richardtape,项目名称:Incipio,代码行数:35,代码来源:functions.php
示例9: check_for_update
function check_for_update()
{
$theme = wp_get_theme($this->theme_slug);
$update_data = get_transient($this->response_key);
if (false === $update_data) {
$failed = false;
$api_params = array('edd_action' => 'get_version', 'license' => $this->license, 'name' => $this->item_name, 'slug' => $this->theme_slug, 'author' => $this->author);
$response = wp_remote_post($this->remote_api_url, array('timeout' => 15, 'body' => $api_params));
// make sure the response was successful
if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
$failed = true;
}
$update_data = json_decode(wp_remote_retrieve_body($response));
if (!is_object($update_data)) {
$failed = true;
}
// if the response failed, try again in 30 minutes
if ($failed) {
$data = new stdClass();
$data->new_version = $theme->get('Version');
set_transient($this->response_key, $data, strtotime('+30 minutes'));
return false;
}
// if the status is 'ok', return the update arguments
if (!$failed) {
$update_data->sections = maybe_unserialize($update_data->sections);
set_transient($this->response_key, $update_data, strtotime('+12 hours'));
}
}
if (version_compare($theme->get('Version'), $update_data->new_version, '>=')) {
return false;
}
return (array) $update_data;
}
开发者ID:rhensley,项目名称:shoestrap,代码行数:34,代码来源:EDD_SL_Theme_Updater.php
示例10: coni_body_classes
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function coni_body_classes($classes)
{
$coni_theme_data = wp_get_theme();
$classes[] = sanitize_title($coni_theme_data['Name']);
$classes[] = 'v' . $coni_theme_data['Version'];
return $classes;
}
开发者ID:nicoandrade,项目名称:Coni,代码行数:13,代码来源:extras.php
示例11: upgrade_theme
/**
* Upgrades theme to its latest version
*
* @since 1.0
* @access public
*
* @param string Name of the theme. If not set checks for updates for the current theme. Default ''.
* @param bool Allow API calls to be cached. Default true.
* @return object A stdClass object.
*/
public function upgrade_theme($theme_name = '', $allow_cache = true)
{
$result = new stdClass();
$result->success = false;
if (empty($theme_name)) {
$theme_name = function_exists('wp_get_theme') ? wp_get_theme()->Name : get_current_theme();
}
$installed_theme = $this->is_theme_installed($theme_name);
if ($installed_theme == null) {
$result->errors = array("'{$theme_name}' theme is not installed");
return $result;
}
$purchased_themes = $this->api->wp_list_themes($allow_cache);
$marketplace_theme_data = null;
if ($errors = $this->api->api_errors()) {
$result->errors = array();
foreach ($errors as $k => $v) {
array_push($result->errors, $v);
}
return $result;
}
foreach ($purchased_themes as $purchased) {
if ($this->is_matching_themes($installed_theme, $purchased) && $this->is_newer_version_available($installed_theme['Version'], $purchased->version)) {
$marketplace_theme_data = $purchased;
break;
}
}
if ($marketplace_theme_data == null) {
$result->errors = array("There is no update available for '{$theme_name}'");
return $result;
}
$result->success = $this->do_upgrade_theme($installed_theme['Title'], $marketplace_theme_data->item_id);
$result->installation_feedback = $this->installation_feedback;
return $result;
}
开发者ID:Neminath,项目名称:lastmile,代码行数:45,代码来源:class-envato-wordpress-theme-upgrader.php
示例12: audiotheme_version_compare
/**
* Compare two version numbers.
*
* This function abstracts the logic for determining the current version
* number for various packages, so the only version number that needs to be
* known is the one to compare against.
*
* Basically serves as a wrapper for the native PHP version_compare()
* function, but allows a known package to be passed as the first parameter.
*
* @since 1.0.0
* @see PHP docs for version_compare()
* @uses version_compare()
*
* @param string $version A package identifier or version number to compare against.
* @param string $version2 The version number to compare to.
* @param string $operator Optional. Relationship to test. <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne
* @return mixed True or false if operator is supplied. -1, 0, or 1 if operator is empty.
*/
function audiotheme_version_compare($version, $version2, $operator = null)
{
switch ($version) {
case 'audiotheme':
$version = AUDIOTHEME_VERSION;
break;
case 'php':
$version = phpversion();
break;
case 'stylesheet':
// Child theme if it exists, otherwise same as template.
$theme = wp_get_theme();
$version = $theme->get('Version');
break;
case 'template':
// Parent theme.
$theme = wp_get_theme(get_template());
$version = $theme->get('Version');
break;
case 'wp':
$version = get_bloginfo('version');
break;
}
return version_compare($version, $version2, $operator);
}
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:44,代码来源:functions.php
示例13: genesisstyletrump_load_stylesheet
/**
* Move Genesis child theme style sheet to a much later priority to give any plugins a chance to load first.
*
* @since 1.0.0
*/
function genesisstyletrump_load_stylesheet()
{
// Get name of current theme
$theme = wp_get_theme();
// Check to see if known themes with parallax scripts are active
// If so, set an earlier priority ($priority) for the main stylesheet
// and specify the additional function ($theme_function_that_loads_parallax_elements) to hook to wp_enqueue_scripts
switch ($theme) {
case 'Parallax Pro Theme':
$priority = 14;
$theme_function_that_loads_parallax_elements = 'parallax_css';
break;
case 'Altitude Pro Theme':
$priority = 14;
$theme_function_that_loads_parallax_elements = 'altitude_css';
break;
case 'Cafe Pro Theme':
$priority = 14;
$theme_function_that_loads_parallax_elements = 'cafe_css';
break;
default:
$priority = 999;
$theme_function_that_loads_parallax_elements = null;
}
remove_action('genesis_meta', 'genesis_load_stylesheet');
add_action('wp_enqueue_scripts', 'genesis_enqueue_main_stylesheet', $priority);
// If there is an additional function defined, hook it to wp_enqueue_scripts
if (!is_null($theme_function_that_loads_parallax_elements)) {
add_action('wp_enqueue_scripts', $theme_function_that_loads_parallax_elements, $priority);
}
}
开发者ID:Bobcatou,项目名称:genesis-style-trump,代码行数:36,代码来源:genesis-style-trump.php
示例14: optionsframework_options
/**
* Defines an array of options that will be used to generate the settings page and be saved in the database.
* When creating the "id" fields, make sure to use all lowercase and no spaces.
*
*/
function optionsframework_options()
{
$themename = 'wp_get_theme' ? wp_get_theme() : wp_get_theme();
$themename = $themename['Name'];
$shortname = "of";
//Stylesheet Reader
$alt_stylesheets = array("black" => "black", "brown" => "brown", "blue" => "blue", "green" => "green", "pink" => "pink", "purple" => "purple", "red" => "red", "yellow" => "yellow");
// Test data
$test_array = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five");
// Multicheck Array
$multicheck_array = array("one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle");
// Multicheck Defaults
$multicheck_defaults = array("one" => "1", "five" => "1");
// Background Defaults
$background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll');
// Pull all the categories into an array
$options_categories = array();
$options_categories_obj = get_categories();
foreach ($options_categories_obj as $category) {
$options_categories[$category->cat_ID] = $category->cat_name;
}
// Pull all the pages into an array
$options_pages = array();
$options_pages_obj = get_pages('sort_column=post_parent,menu_order');
$options_pages[''] = 'Select a page:';
foreach ($options_pages_obj as $page) {
$options_pages[$page->ID] = $page->post_title;
}
// If using image radio buttons, define a directory path
$imagepath = get_stylesheet_directory_uri() . '/images/';
$options = array(array("name" => __("General Settings", "wrockmetro"), "type" => "heading"), array("name" => __("Custom Favicon URL", "wrockmetro"), "desc" => "Specify a 16px x 16px image that will represent your website's favicon.", "id" => "wrockmetro_favicon", "type" => "upload"), array("name" => __("Latest Posts", "wrockmetro"), "desc" => "Show 5 Latest Posts with Thumbnail in Sidebar.", "id" => "wrockmetro_activate_ltposts", "std" => "1", "type" => "checkbox"), array("name" => __("Show Author Profile", "wrockmetro"), "desc" => "Check the box to show Author Profile Below the Post.", "id" => "wrockmetro_author", "std" => "", "type" => "checkbox"), array("name" => __("Ads Management", "wrockmetro"), "type" => "heading"), array("name" => "Activate Ads Space Below Navigation", "desc" => "Activate Ads Space Below Navigation and put code in below test field.", "id" => "wrockmetro_banner", "std" => "", "type" => "checkbox"), array("name" => __("Ads code Below Main Navigation.", "wrockmetro"), "desc" => "Enter your ads code here, preferably a 728*15 link list unit, or a 728*90 lead-board ad.", "id" => "wrockmetro_banner_top", "std" => "", "type" => "textarea"), array("name" => __("AD Code For Single Post", "wrockmetro"), "desc" => "Path of the image to be displayed in sidebar section.", "id" => "wrockmetro_ad2", "std" => "", "type" => "textarea"), array("name" => __("AD Code For Footer", "wrockmetro"), "desc" => "Paste Ad Code for Footer Area below navigation.", "id" => "wrockmetro_ad1", "std" => "", "type" => "textarea"), $options[] = array("name" => __("Custom CSS", "wrockmetro"), "type" => "heading"), array("name" => __("Custom CSS", "wrockmetro"), "desc" => "Quickly add some CSS to your theme by adding it to this block.", "id" => "wrockmetro_customcss", "std" => "", "type" => "textarea"), array("name" => __("Social Media", "wrockmetro"), "type" => "heading"), array("name" => __("Show Social Follow ICONs", "wrockmetro"), "desc" => "Check the box to show social sites Follows buttons in Sidebar.", "id" => "wrockmetro_sharebut", "std" => "", "type" => "checkbox"), array("name" => __("Facebook URL", "wrockmetro"), "desc" => "Enter your Facebook URL if you have one", "id" => "wrockmetro_fb", "std" => "", "type" => "text"), array("name" => __("Twitter URL", "wrockmetro"), "desc" => "Enter your Twitter URL if you have one", "id" => "wrockmetro_tw", "std" => "", "type" => "text"), array("name" => __("RSS Feed URL", "wrockmetro"), "desc" => "Enter your RSS Feed URL if you have one", "id" => "wrockmetro_rss", "std" => "", "type" => "text"), array("name" => __("Google+ URL", "wrockmetro"), "desc" => "Enter your Google+ Link if you have one", "id" => "wrockmetro_gp", "std" => "", "type" => "text"), array("name" => __("Linked In URL", "wrockmetro"), "desc" => "Enter your Linkedin URL if you have one", "id" => "wrockmetro_in", "std" => "", "type" => "text"), array("name" => __("YouTube In URL", "wrockmetro"), "desc" => "Enter your YouTube URL if you have one", "id" => "wrockmetro_youtube", "std" => "", "type" => "text"), array("name" => __("Pinterest In URL", "wrockmetro"), "desc" => "Enter your Pinterest URL if you have one", "id" => "wrockmetro_pinterest", "std" => "", "type" => "text"), array("name" => __("Stumbleupon In URL", "wrockmetro"), "desc" => "Enter your Stumbleupon URL if you have one", "id" => "wrockmetro_stumbleupon", "std" => "", "type" => "text"), array("name" => __("Instagram In URL", "wrockmetro"), "desc" => "Enter your Instagram URL if you have one", "id" => "wrockmetro_instagram", "std" => "", "type" => "text"), array("name" => __("email In URL", "wrockmetro"), "desc" => "Enter your email URL if you have one", "id" => "wrockmetro_email", "std" => "", "type" => "text"));
update_option('of_themename', $themename);
return $options;
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:39,代码来源:theme-options.php
示例15: widgets_init
public static function widgets_init()
{
global $wp_widget_factory, $wp_version;
$widget_class = 'piklist_universal_widget';
foreach (piklist::$paths as $from => $path) {
if (!piklist::directory_empty($path . '/parts/widgets')) {
$widget_class_name = $widget_class . '_' . piklist::slug($from);
$suffix = '';
if (isset(piklist_add_on::$available_add_ons[$from])) {
if (stripos(piklist_add_on::$available_add_ons[$from]['Name'], 'widget') === false) {
$suffix = ' ' . __('Widgets', 'piklist');
}
$title = piklist_add_on::$available_add_ons[$from]['Name'] . $suffix;
$description = strip_tags(piklist_add_on::$available_add_ons[$from]['Description']);
} elseif ($from == 'piklist') {
$title = __('Piklist Widgets', 'piklist');
$description = __('Core Widgets for Piklist.', 'piklist');
} elseif ($from == 'theme') {
$current_theme = wp_get_theme();
$title = $current_theme . ' ' . __('Widgets', 'piklist');
$description = sprintf(__('Widgets for the %s Theme', 'piklist'), $current_theme);
}
$wp_widget_factory->widgets[$widget_class_name] = new $widget_class($widget_class_name, $title, $description, array($from => $path));
}
}
}
开发者ID:Themes-Protoarte,项目名称:piklist,代码行数:26,代码来源:class-piklist-widget.php
示例16: automatic_GitHub_updates
function automatic_GitHub_updates($data)
{
// Theme information
$theme = get_stylesheet();
// Get the folder name of the current theme
$current = wp_get_theme()->get('Version');
// Get the version of the current theme
// GitHub information
$user = 'slfrsn';
// The GitHub username hosting the repository
$repo = 'divi-cinematic';
// Repository name as it appears in the URL
// Get the latest release tag from the repository. The User-Agent header must be sent, as per
// GitHub's API documentation: https://developer.github.com/v3/#user-agent-required
$file = @json_decode(@file_get_contents('https://api.github.com/repos/' . $user . '/' . $repo . '/releases/latest', false, stream_context_create(['http' => ['header' => "User-Agent: " . $user . "\r\n"]])));
if ($file) {
// Strip the version number of any non-alpha characters (excluding the period)
// This way you can still use tags like v1.1 or ver1.1 if desired
$update = filter_var($file->tag_name, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
// Only return a response if the new version number is higher than the current version
if ($update > $current) {
$data->response[$theme] = array('theme' => $theme, 'new_version' => $update, 'url' => 'https://github.com/' . $user . '/' . $repo, 'package' => $file->assets[0]->browser_download_url);
}
}
return $data;
}
开发者ID:slfrsn,项目名称:Divi-Cinematic,代码行数:26,代码来源:functions.php
示例17: update_notifier
function update_notifier()
{
$xml = get_latest_theme_version(NOTIFIER_CACHE_INTERVAL);
// Get the latest remote XML file on our server
$theme_data = wp_get_theme(TEMPLATEPATH . '/style.css');
// Read theme current version from the style.css
?>
<style>
.update-nag { display: none; }
#instructions {max-width: 670px;}
h3.title {margin: 30px 0 0 0; padding: 30px 0 0 0; border-top: 1px solid #ddd;}
</style>
<div class="wrap">
<div id="icon-tools" class="icon32"></div>
<h2><?php
echo NOTIFIER_THEME_NAME;
?>
Theme Updates</h2>
<div id="message" class="updated below-h2"><p><strong>There is a new version of the <?php
echo NOTIFIER_THEME_NAME;
?>
theme available.</strong> You have version <?php
echo $theme_data['Version'];
?>
installed. Update to version <?php
echo $xml->latest;
?>
.</p></div>
<img style="float: left; margin: 0 20px 20px 0; border: 1px solid #ddd;" src="<?php
echo get_template_directory_uri() . '/screenshot.png';
?>
" />
<div id="instructions">
<h3>Update Download and Instructions</h3>
<p><strong>Please note:</strong> make a <strong>backup</strong> of the Theme inside your WordPress installation folder <strong>/wp-content/themes/<?php
echo NOTIFIER_THEME_FOLDER_NAME;
?>
/</strong></p>
<p>To update the Theme, login to <a href="http://www.themeforest.net/?ref=thunderthemes">ThemeForest</a>, head over to your <strong>downloads</strong> section and re-download the theme like you did when you bought it.</p>
<p>Extract the zip's contents, look for the extracted theme folder, and after you have all the new files upload them using FTP to the <strong>/wp-content/themes/<?php
echo NOTIFIER_THEME_FOLDER_NAME;
?>
/</strong> folder overwriting the old ones (this is why it's important to backup any changes you've made to the theme files).</p>
<p>If you didn't make any changes to the theme files, you are free to overwrite them with the new ones without the risk of losing theme settings, pages, posts, etc, and backwards compatibility is guaranteed.</p>
</div>
<h3 class="title">Changelog</h3>
<?php
echo $xml->changelog;
?>
</div>
<?php
}
开发者ID:davidHuanghw,项目名称:david_blog,代码行数:60,代码来源:update-notifier.php
示例18: setup_data
/**
* Setup the data that is going to be tracked
*
* @access private
* @return void
*/
private function setup_data()
{
$data = array();
// Retrieve current theme info
if (get_bloginfo('version') < '3.4') {
$theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
$theme = $theme_data['Name'] . ' ' . $theme_data['Version'];
} else {
$theme_data = wp_get_theme();
$theme = $theme_data->Name . ' ' . $theme_data->Version;
}
$data['url'] = home_url();
$data['theme'] = $theme;
$data['email'] = get_bloginfo('admin_email');
// Retrieve current plugin information
if (!function_exists('get_plugins')) {
include ABSPATH . '/wp-admin/includes/plugin.php';
}
$plugins = array_keys(get_plugins());
$active_plugins = get_option('active_plugins', array());
foreach ($plugins as $key => $plugin) {
if (in_array($plugin, $active_plugins)) {
// Remove active plugins from list so we can show active and inactive separately
unset($plugins[$key]);
}
}
$data['active_plugins'] = $active_plugins;
$data['inactive_plugins'] = $plugins;
$data['products'] = wp_count_posts('download')->publish;
$this->data = $data;
}
开发者ID:harish94,项目名称:Easy-Digital-Downloads,代码行数:37,代码来源:tracking.php
示例19: optionsframework_option_name
/**
* A unique identifier is defined to store the options in the database and reference them from the theme.
* By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed.
* If the identifier changes, it'll appear as if the options have been reset.
*/
function optionsframework_option_name()
{
// Change this to use your theme slug
$themename = wp_get_theme();
$themename = preg_replace("/\\W/", "_", strtolower($themename));
return $themename;
}
开发者ID:xxf1995,项目名称:alphaV,代码行数:12,代码来源:options.php
示例20: _tarski_list_header_images
/**
* Return a list of header images, both from the Tarski directory and the child
* theme (if one is being used).
*
* @uses get_tarski_option
* @uses wp_get_theme
* @uses get_template_directory_uri
* @uses get_stylesheet_directory_uri
*
* @return array
*/
function _tarski_list_header_images()
{
$headers = array();
$dirs = array('Tarski' => get_template_directory());
$current = get_tarski_option('header');
$theme = wp_get_theme();
if (strlen($theme->Template) > 0) {
$dirs[$theme->Name] = get_stylesheet_directory();
}
foreach ($dirs as $theme_name => $dir) {
$dirpath = $dir . '/headers';
if (is_dir($dirpath)) {
$header_dir = dir($dirpath);
} else {
continue;
}
while ($file = $header_dir->read()) {
if (preg_match('/^[^.].+\\.(jpg|png|gif)/', $file) && !preg_match('/-thumb\\.(jpg|png|gif)$/', $file)) {
$name = $theme_name . '/' . $file;
$id = 'header_' . preg_replace('/[^a-z_]/', '_', strtolower($name));
$path = $dir == get_template_directory() ? '%1$s' : '%2$s';
$thumb = preg_replace('/(\\.(?:png|gif|jpg))/', '-thumb\\1', $file);
$uri = $dir == get_template_directory() ? get_template_directory_uri() : get_stylesheet_directory_uri();
$is_current = is_string($current) && $current == $file || $current[0] == $theme_name && $current[1] == $file;
$headers[] = array('name' => $name, 'id' => $id, 'lid' => 'for_' . $id, 'path' => "{$uri}/headers/{$file}", 'current' => $is_current, 'thumb' => "{$uri}/headers/{$thumb}", 'description' => $name, 'url' => "{$path}/headers/{$file}", 'thumbnail_url' => "{$path}/headers/{$thumb}");
}
}
}
return $headers;
}
开发者ID:aleksking,项目名称:sherrill,代码行数:41,代码来源:core.php
注:本文中的wp_get_theme函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论