本文整理汇总了PHP中get_current_theme函数的典型用法代码示例。如果您正苦于以下问题:PHP get_current_theme函数的具体用法?PHP get_current_theme怎么用?PHP get_current_theme使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_current_theme函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
View::share(array('theme' => get_current_theme(), 'pages' => array('products', 'categories', 'pages', 'purchases'), 'results' => array('Users' => admin_path('users'), 'Settings' => admin_path('settings'), 'Log out' => admin_path('logout')), 'welcome_message' => Plugin::fire('admin.welcome_message', 'Welcome to Aviate!')->last()));
// Don't use Bootstrap-style inputs
Former::framework('Nude');
return $this->beforeFilter('auth|install');
}
示例2: get_post_templates
/**
* Scans the template files of the active theme, and returns an
* array of [Template Name => {file}.php]
*
* @since 0.2.0
*
* @return array
*/
function get_post_templates()
{
$themes = get_themes();
$theme = get_current_theme();
$templates = $themes[$theme]['Template Files'];
$post_templates = array();
$base = array(trailingslashit(get_template_directory()), trailingslashit(get_stylesheet_directory()));
foreach ((array) $templates as $template) {
$template = WP_CONTENT_DIR . str_replace(WP_CONTENT_DIR, '', $template);
$basename = str_replace($base, '', $template);
/** Don't allow template files in subdirectories */
if (false !== strpos($basename, '/')) {
continue;
}
$template_data = implode('', file($template));
$name = '';
if (preg_match('|Single Post Template:(.*)$|mi', $template_data, $name)) {
$name = _cleanup_header_comment($name[1]);
}
if (!empty($name)) {
if (basename($template) != basename(__FILE__)) {
$post_templates[trim($name)] = $basename;
}
}
}
return $post_templates;
}
示例3: hybrid_get_post_templates
/**
* Function for getting an array of available custom templates with a specific header. Ideally,
* this function would be used to grab custom singular post (any post type) templates.
*
* @since 0.7
* @param array $args Arguments to check the templates against.
* @return array $post_templates The array of templates.
*/
function hybrid_get_post_templates( $args = array() ) {
$args = wp_parse_args( $args, array( 'label' => array( 'Post Template' ) ) );
$themes = get_themes();
$theme = get_current_theme();
$templates = $themes[$theme]['Template Files'];
$post_templates = array();
if ( is_array( $templates ) ) {
$base = array( trailingslashit( get_template_directory() ), trailingslashit( get_stylesheet_directory() ) );
foreach ( $templates as $template ) {
$basename = str_replace( $base, '', $template );
$template_data = implode( '', file( $template ) );
$name = '';
foreach ( $args['label'] as $label ) {
if ( preg_match( "|{$label}:(.*)$|mi", $template_data, $name ) ) {
$name = _cleanup_header_comment( $name[1] );
break;
}
}
if ( !empty( $name ) )
$post_templates[trim( $name )] = $basename;
}
}
return $post_templates;
}
示例4: srslide_create_debug_info
/**
* Put together some debug info to send to SimpleReach when support
* is requested.
*
* @author Eric Lubow <elubow@simplereach.com>
* @param None
* @return String Debug info
*/
function srslide_create_debug_info()
{
$attrs = array();
$attrs['pid'] = get_option('srslide_pid');
$attrs['email'] = get_option('srslide_sr_login');
$attrs['website'] = get_option('siteurl');
$attrs['account'] = get_option('blogname');
$attrs['user_api_key'] = get_option('srslide_api_key');
$attrs['wp_version'] = get_bloginfo('version');
$attrs['plugin_version'] = SRSLIDE_PLUGIN_VERSION;
$attrs['show_slide_logo'] = get_option('srslide_show_logo');
$attrs['header_text'] = get_option('srslide_header_text');
$attrs['use_wp_pages'] = get_option('srslide_use_pages');
$attrs['styles'] = serialize(get_option('srslide_styles'));
$attrs['account'] = get_option('blogname');
$attrs['php_version'] = phpversion();
$attrs['curl_version'] = _srslide_get_curl_version();
$attrs['curl_ssl'] = _srslide_get_curl_ssl();
$attrs['curl_https_enabled'] = _srslide_get_curl_ssl_enabled();
$attrs['wp_plugins'] = _srslide_get_wp_plugins();
if ($theme_name = get_current_theme()) {
$attrs['theme'] = $theme_name;
$theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
if (is_array($theme_data)) {
foreach ($theme_data as $k => $v) {
$attrs['theme_' . $k] = $v;
}
}
}
$str = '';
foreach ($attrs as $attr => $value) {
$str .= $attr . ': ' . $value . "\n";
}
return $str;
}
示例5: create_zip
function create_zip($themeName)
{
$exclude_files = array('.', '..', '.svn', 'thumbs.db', '!sources', 'style.less.cache', 'bootstrap.less.cache', '.gitignore', '.git');
$all_themes_dir = str_replace('\\', '/', get_theme_root());
$backup_dir = str_replace('\\', '/', WP_CONTENT_DIR) . '/themes_backup';
$zip_name = $backup_dir . "/" . $themeName . '.zip';
$backup_date = date("F d Y");
if (is_dir($all_themes_dir . "/" . $themeName)) {
$file_string = scan_dir($all_themes_dir . "/" . $themeName, $exclude_files);
}
if (function_exists('wp_get_theme')) {
$backup_version = wp_get_theme($themeName)->Version;
} else {
$backup_version = get_current_theme($themeName)->Version;
}
if (!is_dir($backup_dir)) {
if (mkdir($backup_dir, 0700)) {
$htaccess_file = fopen($backup_dir . '/.htaccess', 'a');
$htaccess_text = 'deny from all';
fwrite($htaccess_file, $htaccess_text);
fclose($htaccess_file);
}
}
$zip = new PclZip($zip_name);
if ($zip->create($file_string, PCLZIP_OPT_REMOVE_PATH, $all_themes_dir . "/" . $themeName) == 0) {
die("Error : " . $zip->errorInfo(true));
}
update_option($themeName . "_date_backup", $backup_date, '', 'yes');
update_option($themeName . "_version_backup", $backup_version, '', 'yes');
echo $backup_date . "," . $backup_version;
}
示例6: __construct
function __construct()
{
global $pagenow;
add_action('init', array($this, 'init'));
if (is_admin()) {
// hooks for saving menus
add_action('wp_create_nav_menu', array($this, 'wp_update_nav_menu'), 10, 2);
add_action('wp_update_nav_menu', array($this, 'wp_update_nav_menu'), 10, 2);
// hook for saving menu items
add_action('wp_update_nav_menu_item', array($this, 'wp_update_nav_menu_item'), 10, 3);
// filter for nav_menu_options
add_filter('option_nav_menu_options', array($this, 'option_nav_menu_options'));
add_action('wp_delete_nav_menu', array($this, 'wp_delete_nav_menu'));
add_action('delete_post', array($this, 'wp_delete_nav_menu_item'));
}
// add language controls for menus no option but javascript
if ($pagenow == 'nav-menus.php') {
add_action('admin_footer', array($this, 'nav_menu_language_controls'), 10);
wp_enqueue_script('wp_nav_menus', ICL_PLUGIN_URL . '/res/js/wp-nav-menus.js', ICL_SITEPRESS_VERSION, true);
wp_enqueue_style('wp_nav_menus_css', ICL_PLUGIN_URL . '/res/css/wp-nav-menus.css', array(), ICL_SITEPRESS_VERSION, 'all');
// filter posts by language
add_action('parse_query', array($this, 'parse_query'));
// filter taxonomies by language
//add_action('get_terms', array($this, 'get_terms'));
// filter menus by language
add_filter('get_terms', array($this, 'get_terms_filter'), 1, 3);
}
add_filter('theme_mod_nav_menu_locations', array($this, 'theme_mod_nav_menu_locations'));
$theme = get_current_theme();
add_filter('pre_update_option_mods_' . $theme, array($this, 'pre_update_theme_mods_theme'));
add_filter('wp_nav_menu_args', array($this, 'wp_nav_menu_args_filter'));
add_filter('wp_nav_menu_items', array($this, 'wp_nav_menu_items_filter'));
}
示例7: show_box1
function show_box1()
{
$android_Theme = get_option('cart_android_theme');
$iphone_Theme = get_option('cart_iphone_theme');
$ipad_Theme = get_option('cart_ipad_theme');
$themes = wp_get_themes();
?>
<div class="inside">
<p><?php
_e('Android Phone Theme Setup', 'WP-OliveCart');
?>
</p>
<select name="android_theme">
<?php
foreach ($themes as $theme) {
if ($android_Theme == $theme['Name'] || $android_Theme == '' && $theme['Name'] == get_current_theme()) {
echo '<option value="' . $theme['Name'] . '" selected="selected">' . $theme['Name'] . '</option>';
} else {
echo '<option value="' . $theme['Name'] . '">' . $theme['Name'] . '</option>';
}
}
?>
</select>
</div>
<?php
}
示例8: 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;
}
示例9: jetpack_load_infinite_scroll_annotation
/**
* Load theme's infinite scroll annotation file, if present in the IS plugin.
* The `setup_theme` action is used because the annotation files should be using `after_setup_theme` to register support for IS.
*
* As released in Jetpack 2.0, a child theme's parent wasn't checked for in the plugin's bundled support, hence the convoluted way the parent is checked for now.
*
* @uses is_admin, wp_get_theme, get_theme, get_current_theme, apply_filters
* @action setup_theme
* @return null
*/
function jetpack_load_infinite_scroll_annotation()
{
if (is_admin() && isset($_GET['page']) && 'jetpack' == $_GET['page']) {
$theme = function_exists('wp_get_theme') ? wp_get_theme() : get_theme(get_current_theme());
if (!is_a($theme, 'WP_Theme') && !is_array($theme)) {
return;
}
/**
* Filter the directory where all Infinite Scroll compat files are located.
*
* @since 2.0.0
*
* @param string $var Infinite Scroll compat file URL.
* @param string $theme['Stylesheet'] Theme directory URI.
*/
$customization_file = apply_filters('infinite_scroll_customization_file', dirname(__FILE__) . "/infinite-scroll/themes/{$theme['Stylesheet']}.php", $theme['Stylesheet']);
if (is_readable($customization_file)) {
require_once $customization_file;
} elseif (!empty($theme['Template'])) {
$customization_file = dirname(__FILE__) . "/infinite-scroll/themes/{$theme['Template']}.php";
if (is_readable($customization_file)) {
require_once $customization_file;
}
}
}
}
示例10: fblikejacker_hg3252325c
function fblikejacker_hg3252325c () {
global $currentdbversionfbj;
$plugin_dir = basename(dirname(__FILE__));
load_plugin_textdomain( 'fblikejacker', 'wp-content/plugins/' . $plugin_dir, $plugin_dir );
$dbv = get_option('fblikejacker_dbv');
$like_active = get_option('fblikejacker_like_active');
if (($dbv != $currentdbversionfbj) && ($like_active != '0')) {
update_option("fblikejacker_like_active",'1');
update_option('fblikejacker_dbv',$currentdbversionfbj);
} elseif (($dbv != $currentdbversionfbj) && ($like_active == '1')) {
update_option('fblikejacker_dbv',$currentdbversionfbj);
}
# footer & header tester
$tested = get_option("fblikejacker_tested");
$theme_name = get_current_theme();
if ($tested != $theme_name) {
update_option("fblikejacker_tested",$theme_name);
add_action( 'admin_init', 'fblikejacker_check_head_footer' );
add_action( 'wp_head', 'fblikejacker_test_head', 99999 );
add_action( 'wp_footer', 'fblikejacker_test_footer', 99999 );
}
if ( isset( $_GET['test-head'] ) )
add_action( 'wp_head', 'fblikejacker_test_head', 99999 );
if ( isset( $_GET['test-footer'] ) )
add_action( 'wp_footer', 'fblikejacker_test_footer', 99999 );
}
示例11: resolveConflicts
function resolveConflicts()
{
$modelConfig =& WYSIJA::get('config', 'model');
$possibleConflictiveThemes = $modelConfig->getValue('conflictiveThemes');
$conflictingTheme = null;
$currentTheme = strtolower(get_current_theme());
foreach ($possibleConflictiveThemes as $keyTheme => $conflictTheme) {
if ($keyTheme === $currentTheme) {
$conflictingTheme = $keyTheme;
}
}
if ($conflictingTheme !== null) {
$helperConflicts =& WYSIJA::get('conflicts', 'helper');
$helperConflicts->resolve(array($possibleConflictiveThemes[$conflictingTheme]));
}
$possibleConflictivePlugins = $modelConfig->getValue("conflictivePlugins");
$conflictingPlugins = array();
foreach ($possibleConflictivePlugins as $keyPlg => $conflictPlug) {
if (WYSIJA::is_plugin_active($conflictPlug['file'])) {
$conflictingPlugins[$keyPlg] = $conflictPlug;
}
}
if ($conflictingPlugins) {
$helperConflicts =& WYSIJA::get("conflicts", "helper");
$helperConflicts->resolve($conflictingPlugins);
}
}
示例12: onRender
/**
* Event called when ready to render the Metabox contents
*
* @param int $id ID of the gallery
* @param object $gallery The gallery object, or post data.
*/
public function onRender($id, $gallery)
{
$current_theme = function_exists('wp_get_theme') ? wp_get_theme() : get_current_theme();
// WP 3.4
$vars = array('custom_css' => get_post_meta($id, self::MT_CSS, true), 'theme_name' => $current_theme);
$this->owner->template->display('meta_gallery_css.html.twig', $vars);
}
示例13: admin_top_level
function admin_top_level()
{
global $top_level_basename;
$top_level_basename = basename(__FILE__);
$optionpage_top_level = get_current_theme() . " Options";
add_menu_page($optionpage_top_level, $optionpage_top_level, 7, basename(__FILE__), 'customize_theme_page');
}
示例14: 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()
{
$themename = preg_replace("/\\W/", "", strtolower(get_current_theme()));
$optionsframework_settings = get_option('optionsframework');
$optionsframework_settings['id'] = $themename;
update_option('optionsframework', $optionsframework_settings);
}
示例15: motopressReset
function motopressReset()
{
require_once 'verifyNonce.php';
require_once 'settings.php';
require_once 'access.php';
require_once 'Requirements.php';
global $motopressSettings;
$templateDir = $motopressSettings['theme_root'] . '/' . get_current_theme() . '/';
$resetDir = WP_CONTENT_DIR . '/motopress-theme-reset/' . get_current_theme() . '/';
foreach (glob($resetDir . '*.php') as $file) {
if (file_exists($templateDir . basename($file))) {
file_put_contents($templateDir . basename($file), file_get_contents($file));
}
}
foreach (glob($resetDir . 'wrapper/' . '*.php') as $file) {
file_put_contents($templateDir . 'wrapper/' . basename($file), file_get_contents($file));
}
foreach (glob($resetDir . 'loop/' . '*.php') as $file) {
file_put_contents($templateDir . 'loop/' . basename($file), file_get_contents($file));
}
foreach (glob($resetDir . 'static/' . '*.php') as $file) {
file_put_contents($templateDir . 'static/' . basename($file), file_get_contents($file));
}
exit;
}