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


PHP get_stylesheet函数代码示例

本文整理汇总了PHP中get_stylesheet函数的典型用法代码示例。如果您正苦于以下问题:PHP get_stylesheet函数的具体用法?PHP get_stylesheet怎么用?PHP get_stylesheet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: chld_thm_cfg_version

function chld_thm_cfg_version($src, $handle)
{
    if (strstr($src, get_stylesheet())) {
        $src = preg_replace("/ver=(.*?)(\\&|\$)/", 'ver=' . wp_get_theme()->Version . "\$2", $src);
    }
    return $src;
}
开发者ID:sourabh-mehra,项目名称:ASVYS-Charity-Foundation,代码行数:7,代码来源:child-theme-configurator.php

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

示例3: status

 /**
  * get status of settings
  *
  * ## EXAMPLES
  *
  *     wp multi-device status
  *
  */
 public function status($args, $assoc_args)
 {
     $options = get_option($this->options);
     $rows = array();
     $slug_table = array('None' => '');
     $themes = wp_get_themes();
     foreach ($themes as $theme_slug => $header) {
         $slug_table[$header->get('Name')] = $theme_slug;
     }
     $rows[] = array('Device' => 'smartphone (Smart Phone)', 'Theme' => $options['theme_smartphone'], 'Slug' => $slug_table[$options['theme_smartphone']], 'UserAgent' => $options['userAgent_smart']);
     $rows[] = array('Device' => 'tablet (Tablet PC)', 'Theme' => $options['theme_tablet'], 'Slug' => $slug_table[$options['theme_tablet']], 'UserAgent' => $options['userAgent_tablet']);
     $rows[] = array('Device' => 'mobile (Mobile Phone)', 'Theme' => $options['theme_mobile'], 'Slug' => $slug_table[$options['theme_mobile']], 'UserAgent' => $options['userAgent_mobile']);
     $rows[] = array('Device' => 'game (Game Platforms)', 'Theme' => $options['theme_game'], 'Slug' => $slug_table[$options['theme_game']], 'UserAgent' => $options['userAgent_game']);
     foreach ($options as $custom_switcher_option => $custom_switcher_theme) {
         if (!preg_match('/^custom_switcher_theme_/', $custom_switcher_option)) {
             continue;
         }
         $custom_switcher_name = preg_replace('/^custom_switcher_theme_/', '', $custom_switcher_option);
         $rows[] = array('Device' => $custom_switcher_name, 'Theme' => $options['custom_switcher_theme_' . $custom_switcher_name], 'Slug' => $slug_table[$options['custom_switcher_theme_' . $custom_switcher_name]], 'UserAgent' => $options['custom_switcher_userAgent_' . $custom_switcher_name]);
     }
     $default_theme = wp_get_theme()->get('Name');
     $default_theme .= ' | ';
     $default_theme .= get_stylesheet();
     WP_CLI::line('Active Theme: ' . $default_theme);
     WP_CLI\Utils\format_items('table', $rows, array('Device', 'Theme', 'Slug', 'UserAgent'));
     $line = '';
     $line .= 'PC Switcher: ';
     $line .= $options['pc_switcher'] ? 'on' : 'off';
     $line .= "\n";
     $line .= 'default CSS: ';
     $line .= $options['default_css'] ? 'on' : 'off';
     WP_CLI::line($line);
 }
开发者ID:dragonwzj,项目名称:multi-device-switcher,代码行数:41,代码来源:wp-cli.php

示例4: __construct

 /**
  * Class constructor.
  */
 public function __construct()
 {
     self::$stylesheet = get_stylesheet();
     /**
      * Load Customizer Colors functionality.
      *
      * @since 1.0.0
      */
     require_once get_template_directory() . '/inc/customizer/colors.php';
     /**
      * Load Customizer Fonts functionality.
      *
      * @since 1.0.0
      */
     require_once get_template_directory() . '/inc/customizer/fonts.php';
     /**
      * Load Customizer Layouts functionality.
      *
      * @since 1.0.0
      */
     require_once get_template_directory() . '/inc/customizer/layouts.php';
     add_action('after_setup_theme', array($this, 'logo'));
     add_action('customize_register', array($this, 'selective_refresh'), 11);
     add_action('customize_register', array($this, 'use_featured_hero_image'));
     add_action('customize_preview_init', array($this, 'customize_preview_js'));
 }
开发者ID:faithmade,项目名称:rock,代码行数:29,代码来源:customizer.php

示例5: admin_page

    public function admin_page()
    {
        ?>
<h1>Theme Search</h1>
<?php 
        if (isset($_POST['search'])) {
            $search = $_POST['search'];
            $theme = wp_get_theme();
            $stylesheet = get_stylesheet();
            $files = $theme->get_files();
            echo '<ul>';
            foreach ($files as $key => $file) {
                $f = fopen($file, 'r');
                $content = fread($f, filesize($file));
                if (stripos($content, $search) !== FALSE) {
                    echo '<li><a href="theme-editor.php?file=' . urlencode($key) . '&theme=' . urlencode($stylesheet) . '">' . $file . '</a></li>';
                }
                fclose($f);
            }
            echo '</ul>';
        }
        ?>
<form method="post" action="themes.php?page=theme-search">
<p>Search for: <input type="text" name="search" /></p>
</form>
<?php 
    }
开发者ID:scotchfield,项目名称:theme-search,代码行数:27,代码来源:theme-search.php

示例6: update_breakpoints

 public function update_breakpoints()
 {
     if (!Upfront_Permissions::current(Upfront_Permissions::SAVE)) {
         $this->_reject();
     }
     $breakpoints = isset($_POST['breakpoints']) ? $_POST['breakpoints'] : array();
     // Parse data types
     foreach ($breakpoints as $index => $breakpoint) {
         $breakpoints[$index]['enabled'] = filter_var($breakpoint['enabled'], FILTER_VALIDATE_BOOLEAN);
         $breakpoints[$index]['default'] = filter_var($breakpoint['default'], FILTER_VALIDATE_BOOLEAN);
         $breakpoints[$index]['width'] = filter_var($breakpoint['width'], FILTER_VALIDATE_INT);
         $breakpoints[$index]['columns'] = filter_var($breakpoint['columns'], FILTER_VALIDATE_INT);
         if (isset($breakpoint['fixed'])) {
             $breakpoints[$index]['fixed'] = filter_var($breakpoint['fixed'], FILTER_VALIDATE_BOOLEAN);
         }
     }
     $responsive_settings = get_option('upfront_' . get_stylesheet() . '_responsive_settings');
     $responsive_settings = apply_filters('upfront_get_responsive_settings', $responsive_settings);
     if (empty($responsive_settings)) {
         $responsive_settings = array('breakpoints' => $breakpoints);
     } else {
         if (is_string($responsive_settings)) {
             $responsive_settings = json_decode($responsive_settings);
         }
         $responsive_settings = (array) $responsive_settings;
         $responsive_settings['breakpoints'] = $breakpoints;
     }
     do_action('upfront_update_responsive_settings', $responsive_settings);
     if (!has_action('upfront_update_responsive_settings')) {
         update_option('upfront_' . get_stylesheet() . '_responsive_settings', json_encode($responsive_settings));
     }
     $this->_out(new Upfront_JsonResponse_Success(get_stylesheet() . ' responsive settings updated'));
 }
开发者ID:sedici,项目名称:wpmu-istec,代码行数:33,代码来源:class_upfront_responsive_server.php

示例7: after

 function after()
 {
     $update_actions = array();
     if (!empty($this->upgrader->result['destination_name']) && ($theme_info = $this->upgrader->theme_info()) && !empty($theme_info)) {
         $name = $theme_info['Name'];
         $stylesheet = $this->upgrader->result['destination_name'];
         $template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;
         $template = $this->installed_theme_key;
         $stylesheet = $this->installed_theme_key;
         $theme_info = get_theme_data(trailingslashit(WP_CONTENT_DIR) . 'themes/' . $stylesheet);
         if (!empty($theme_info['Template'])) {
             $template = $theme_info['Template'];
         }
         // End IF Statement
         $preview_link = htmlspecialchars(add_query_arg(array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true'), trailingslashit(esc_url(get_option('home')))));
         $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=" . urlencode($template) . "&amp;stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
         $update_actions['preview'] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;', 'woothemes'), $name)) . '">' . __('Preview', 'woothemes') . '</a>';
         $update_actions['activate'] = '<a href="' . $activate_link . '" class="activatelink" title="' . esc_attr(sprintf(__('Activate &#8220;%s&#8221;', 'woothemes'), $name)) . '">' . __('Activate', 'woothemes') . '</a>';
         if (!$this->result || is_wp_error($this->result) || $stylesheet == get_stylesheet()) {
             unset($update_actions['preview'], $update_actions['activate']);
         }
         $update_actions['themes_page'] = '<a href="' . admin_url('themes.php?page=woo-installer') . '" title="' . esc_attr(__('Install other WooThemes', 'woothemes')) . '" target="_parent">' . __('Install other WooThemes', 'woothemes') . '</a>';
     }
     $update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->installed_theme_key);
     if (!empty($update_actions)) {
         $this->feedback('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array) $update_actions));
     }
 }
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:28,代码来源:upgrader-skin.class.php

示例8: jetpack_load_theme_compat

/**
 * Load theme compat file if it exists.
 */
function jetpack_load_theme_compat()
{
    /**
     * Filter theme compat files.
     *
     * Themes can add their own compat files here if they like. For example:
     *
     * add_filter( 'jetpack_theme_compat_files', 'mytheme_jetpack_compat_file' );
     * function mytheme_jetpack_compat_file( $files ) {
     *     $files['mytheme'] = locate_template( 'jetpack-compat.php' );
     *     return $files;
     * }
     *
     * @module theme-tools
     *
     * @since 2.8.0
     *
     * @param array Associative array of theme compat files to load.
     */
    $compat_files = apply_filters('jetpack_theme_compat_files', array('twentyfourteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfourteen.php', 'twentyfifteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfifteen.php'));
    _jetpack_require_compat_file(get_stylesheet(), $compat_files);
    if (is_child_theme()) {
        _jetpack_require_compat_file(get_template(), $compat_files);
    }
}
开发者ID:rbryerking,项目名称:skillcrush-wordpress,代码行数:28,代码来源:theme-tools.php

示例9: ct_fix_invalid_menus

/**
 * Fixes 1 Click demo import when invalid data was imported
 */
function ct_fix_invalid_menus()
{
    $key = 'theme_mods_' . get_stylesheet();
    if (!is_array(get_option($key))) {
        update_option($key, array());
    }
}
开发者ID:clevervaughn,项目名称:dottiesbiscuitbarn,代码行数:10,代码来源:functions.php

示例10: ar2_theme_options_default_fields

/**
 * Retrieves default setting fields for theme options.
 * @since 1.6
 */
function ar2_theme_options_default_fields()
{
    global $ar2_image_sizes, $ar2_styles;
    $_defaults = array('theme_version' => array('type' => 'static', 'title' => __('Version', 'ar2'), 'section' => 'ar2_general_site_info', 'content' => '<strong>' . wp_get_theme()->get('Version') . '</strong>', 'description' => __('If you have recently upgraded Project AR2 to a new release, it is <span style="color: red">highly recommended</span> that you reset your theme options, clear your browser cache and restart your browser before proceeding.', 'ar2')), 'site_rss_feed' => array('type' => 'static', 'title' => __('RSS Feed', 'ar2'), 'section' => 'ar2_general_social', 'content' => '<code>' . get_feed_link('rss2') . '</code>', 'description' => __('Custom feed URLs are no longer allowed due to support for automatic feed links.', 'ar2')), 'social_twitter' => array('type' => 'input', 'title' => __('Twitter Username', 'ar2'), 'section' => 'ar2_general_social'), 'social_facebook' => array('type' => 'input', 'title' => __('Facebook Username', 'ar2'), 'section' => 'ar2_general_social'), 'social_flickr' => array('type' => 'input', 'title' => __('Flickr ID', 'ar2'), 'section' => 'ar2_general_social'), 'social_gplus' => array('type' => 'input', 'title' => __('Google+ ID', 'ar2'), 'section' => 'ar2_general_social'), 'social_youtube' => array('type' => 'input', 'title' => __('YouTube Channel ID', 'ar2'), 'section' => 'ar2_general_social'), 'footer_message' => array('type' => 'textarea_html', 'title' => __('Footer Message', 'ar2'), 'section' => 'ar2_general_footer', 'description' => __("Usually your website's copyright information would go here.<br /> It would be great if you could include a link to WordPress or the theme website. :)", 'ar2'), 'extras' => 'class="code"'), 'nodebased_show_excerpts' => array('type' => 'switch', 'title' => __('Show Excerpts', 'ar2'), 'section' => 'ar2_layout_excerpts'), 'excerpt_limit' => array('type' => 'input', 'title' => __('Excerpt Limit', 'ar2'), 'section' => 'ar2_layout_excerpts', 'extras' => 'style="width: 50px" maxlength="2"', 'description' => __('Excerpts will only be trimmed to the limit if no excerpt is specified for the respective post.', 'ar2')), 'archive_display' => array('type' => 'dropdown', 'title' => __('Display Type', 'ar2'), 'section' => 'ar2_layout_archive', 'options' => ar2_get_archive_display_types()), 'single_posts_display' => array('type' => 'custom', 'title' => __('Display in Single Posts', 'ar2'), 'section' => 'ar2_layout_single', 'callback' => 'ar2_render_single_form_field', 'setting' => 'ar2_theme_options[post_display]'), 'relative_dates' => array('type' => 'checkbox', 'title' => __('Display Relative Post Dates', 'ar2'), 'section' => 'ar2_layout_single', 'description' => __('Check this to display post dates relative to current time (eg. 2 days ago ).', 'ar2')), 'auto_thumbs' => array('type' => 'checkbox', 'title' => __('Auto Thumbnails', 'ar2'), 'section' => 'ar2_thumbnails_options', 'description' => __('Check this to allow the theme to automatically retrieve the first attached image from the post as featured image when no image is specified.', 'ar2')), 'layout' => array('type' => 'dropdown', 'title' => __('No of Columns', 'ar2'), 'section' => 'ar2_design_overall', 'options' => $ar2_styles->get_layouts()), 'import_theme_options' => array('type' => 'textarea', 'title' => __('Import Theme Options', 'ar2'), 'section' => 'ar2_tools_port', 'description' => __('Import your theme settings by pasting the exported code in the textbox above.', 'ar2'), 'extras' => 'class="code"'), 'export_theme_options' => array('type' => 'textarea', 'title' => __('Export Theme Options', 'ar2'), 'section' => 'ar2_tools_port', 'description' => __('You can save the code above into a text file and use it when you need to import them into another installation. Note that not all options (custom background, child theme settings, etc.) will be exported.', 'ar2'), 'extras' => 'class="code"', 'value' => json_encode(ar2_flush_theme_options())));
    foreach ($ar2_image_sizes as $id => $args) {
        $_defaults[$id] = array('type' => 'thumbnail-size', 'title' => $args['name'], 'setting' => 'ar2_theme_options[thumbnails][' . $id . ']', 'section' => 'ar2_thumbnails_sizes', 'width' => $args['w'], 'height' => $args['h'], 'd_width' => $args['dw'], 'd_height' => $args['dh']);
    }
    if (AR2_ALLOW_CUSTOM_STYLES) {
        $_defaults['style'] = array('type' => 'dropdown', 'title' => __('Custom Stylesheet', 'ar2'), 'section' => 'ar2_design_overall', 'options' => ar2_get_custom_css_files(), 'description' => sprintf(__('Stylesheets can be placed in %s.', 'ar2'), '<code>wp-content/themes/' . get_stylesheet() . '/css/styles/</code>'));
    }
    // Allow developers to add more fields
    $_defaults = apply_filters('ar2_theme_options_fields', $_defaults);
    // Process the fields
    $sections = ar2_theme_options_default_sections();
    $_default_args = array('title' => '', 'type' => 'static', 'section' => 'ar2_general_site_info', 'page' => 'ar2_general', 'content' => '', 'extras' => '');
    foreach ($_defaults as $id => &$args) {
        if (!isset($args['setting'])) {
            $args['setting'] = 'ar2_theme_options[' . $id . ']';
        }
        // Parse the ID for array keys (adapted from WP_Customize_Setting class).
        $args['_id_data']['keys'] = preg_split('/\\[/', str_replace(']', '', $args['setting']));
        $args['_id_data']['base'] = array_shift($args['_id_data']['keys']);
        if (isset($sections[$args['section']])) {
            $args['page'] = $sections[$args['section']]['page'];
        }
        $args = wp_parse_args($args, $_default_args);
    }
    return $_defaults;
}
开发者ID:SublimeCoralie,项目名称:project-ar2,代码行数:33,代码来源:admin.php

示例11: is_active

 /**
  * Whether the theme is active.
  *
  * @since 1.0.0
  *
  * @return boolean
  */
 public function is_active()
 {
     if (is_multisite()) {
         return false;
     }
     return get_stylesheet() === $this->get_slug() || get_template() === $this->get_slug();
 }
开发者ID:audiotheme,项目名称:audiotheme-agent,代码行数:14,代码来源:Theme.php

示例12: thoughtfulmuse_scripts

/**
 * Enqueues scripts and styles.
 */
function thoughtfulmuse_scripts()
{
    // Parent theme stylesheet
    wp_enqueue_style('twentysixteen-style', get_template_directory_uri() . '/style.css', false, filemtime(get_template_directory() . '/style.css'));
    // Child theme stylesheet
    wp_enqueue_style('thoughtfulmuse-style', get_stylesheet_uri(), array('twentysixteen-style'), filemtime(get_stylesheet()));
}
开发者ID:creativecoder,项目名称:thoughtfulmuse,代码行数:10,代码来源:functions.php

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

示例14: does_theme_include_idx_tag

 public function does_theme_include_idx_tag()
 {
     // default page content
     //the empty div is for any content they add to the visual editor so it displays
     $post_content = '<div></div><div id="idxStart" style="display: none;"></div><div id="idxStop" style="display: none;"></div>';
     // get theme to check start/stop tag
     $does_theme_include_idx_tag = false;
     $template_root = get_theme_root() . DIRECTORY_SEPARATOR . get_stylesheet();
     $files = scandir($template_root);
     foreach ($files as $file) {
         $path = $template_root . DIRECTORY_SEPARATOR . $file;
         if (is_file($path) && preg_match('/.*\\.php/', $file)) {
             $content = file_get_contents($template_root . DIRECTORY_SEPARATOR . $file);
             if (preg_match('/<div[^>\\n]+?id=[\'"]idxstart[\'"].*?(\\/>|><\\/div>)/i', $content)) {
                 if (preg_match('/<div[^>\\n]+?id=[\'"]idxstop[\'"].*?(\\/>|><\\/div>)/i', $content)) {
                     $does_theme_include_idx_tag = true;
                     break;
                 }
             }
         }
     }
     if ($does_theme_include_idx_tag || function_exists('equity')) {
         $post_content = '';
     }
     return $post_content;
 }
开发者ID:jdelia,项目名称:wordpress-plugin,代码行数:26,代码来源:wrappers.php

示例15: get_edition_data

 public static function get_edition_data()
 {
     if ('POST' !== $_SERVER['REQUEST_METHOD']) {
         return;
     }
     if ('update' !== mainwp_wp_stream_filter_input(INPUT_POST, 'action')) {
         return;
     }
     $theme_slug = mainwp_wp_stream_filter_input(INPUT_POST, 'theme') ? mainwp_wp_stream_filter_input(INPUT_POST, 'theme') : get_stylesheet();
     $theme = wp_get_theme($theme_slug);
     if (!$theme->exists() || $theme->errors() && 'theme_no_stylesheet' === $theme->errors()->get_error_code()) {
         return;
     }
     $allowed_files = $theme->get_files('php', 1);
     $style_files = $theme->get_files('css');
     $allowed_files['style.css'] = $style_files['style.css'];
     $file = mainwp_wp_stream_filter_input(INPUT_POST, 'file');
     if (empty($file)) {
         $file_name = 'style.css';
         $file_path = $allowed_files['style.css'];
     } else {
         $file_name = $file;
         $file_path = sprintf('%s/%s', $theme->get_stylesheet_directory(), $file_name);
     }
     $file_contents_before = file_get_contents($file_path);
     self::$edited_file = compact('file_name', 'file_path', 'file_contents_before', 'theme');
 }
开发者ID:HasClass0,项目名称:mainwp-child-reports,代码行数:27,代码来源:editor.php


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