• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_stylesheet函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: jetpack_load_theme_compat

/**
 * Load theme compat file if it exists.
 *
 * A theme could add its 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;
 * }
 */
function jetpack_load_theme_compat()
{
    $compat_files = apply_filters('jetpack_theme_compat_files', array('twentyfourteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfourteen.php'));
    _jetpack_require_compat_file(get_stylesheet(), $compat_files);
    if (is_child_theme()) {
        _jetpack_require_compat_file(get_template(), $compat_files);
    }
}
开发者ID:KurtMakesWeb,项目名称:CandG,代码行数:19,代码来源:theme-tools.php


示例17: tamatebako_child_theme_version

/**
 * Helper Function: Get (child) theme version
 * This function is to properly add version number to scripts and styles.
 * @since 0.1.0
 */
function tamatebako_child_theme_version()
{
    if (is_child_theme()) {
        $theme = wp_get_theme(get_stylesheet());
        return $theme->get('Version');
    }
    return tamatebako_theme_version();
}
开发者ID:WPDevHQ,项目名称:nevertheless,代码行数:13,代码来源:helper.php


示例18: __construct

 protected function __construct()
 {
     parent::__construct();
     $this->elementName = $this->get_element_name();
     $this->db_key = 'upfront_' . get_stylesheet() . '_' . $this->elementName . '_presets';
     $registry = Upfront_PresetServer_Registry::get_instance();
     $registry->set($this->elementName, $this);
 }
开发者ID:sedici,项目名称:wpmu-istec,代码行数:8,代码来源:class_upfront_presets_server.php


示例19: thematic_widgets_init

function thematic_widgets_init()
{
    // Define array for the widgetized areas
    $thematic_widgetized_areas = array('Header Widgets' => array('admin_menu_order' => 100, 'args' => array('name' => 'Header Widgets', 'id' => 'hdr-widgets', 'description' => __('The header widget area for additional mast head items.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_header', 'function' => 'thematic_widget_header', 'priority' => 10), 'Primary Aside' => array('admin_menu_order' => 200, 'args' => array('name' => 'Primary Aside', 'id' => 'primary-aside', 'description' => __('The primary widget area, most often used as a sidebar.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_primary_aside', 'function' => 'thematic_primary_aside', 'priority' => 10), 'Secondary Aside' => array('admin_menu_order' => 300, 'args' => array('name' => 'Secondary Aside', 'id' => 'secondary-aside', 'description' => __('The secondary widget area, most often used as a sidebar.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_secondary_aside', 'function' => 'thematic_secondary_aside', 'priority' => 10), '1st Subsidiary Aside' => array('admin_menu_order' => 400, 'args' => array('name' => '1st Subsidiary Aside', 'id' => '1st-subsidiary-aside', 'description' => __('The 1st widget area in the footer.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_subsidiaries', 'function' => 'thematic_1st_subsidiary_aside', 'priority' => 30), '2nd Subsidiary Aside' => array('admin_menu_order' => 500, 'args' => array('name' => '2nd Subsidiary Aside', 'id' => '2nd-subsidiary-aside', 'description' => __('The 2nd widget area in the footer.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_subsidiaries', 'function' => 'thematic_2nd_subsidiary_aside', 'priority' => 50), '3rd Subsidiary Aside' => array('admin_menu_order' => 600, 'args' => array('name' => '3rd Subsidiary Aside', 'id' => '3rd-subsidiary-aside', 'description' => __('The 3rd widget area in the footer.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_subsidiaries', 'function' => 'thematic_3rd_subsidiary_aside', 'priority' => 70), 'Index Top' => array('admin_menu_order' => 700, 'args' => array('name' => 'Index Top', 'id' => 'index-top', 'description' => __('The top widget area displayed on the index page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_index_top', 'function' => 'thematic_index_top', 'priority' => 10), 'Index Insert' => array('admin_menu_order' => 800, 'args' => array('name' => 'Index Insert', 'id' => 'index-insert', 'description' => __('The widget area inserted after x posts on the index page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_index_insert', 'function' => 'thematic_index_insert', 'priority' => 10), 'Index Bottom' => array('admin_menu_order' => 900, 'args' => array('name' => 'Index Bottom', 'id' => 'index-bottom', 'description' => __('The bottom widget area displayed on the index page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_index_bottom', 'function' => 'thematic_index_bottom', 'priority' => 10), 'Single Top' => array('admin_menu_order' => 1000, 'args' => array('name' => 'Single Top', 'id' => 'single-top', 'description' => __('The top widget area displayed on a single post.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_single_top', 'function' => 'thematic_single_top', 'priority' => 10), 'Single Insert' => array('admin_menu_order' => 1100, 'args' => array('name' => 'Single Insert', 'id' => 'single-insert', 'description' => __('The widget area inserted between the post and the comments on a single post.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_single_insert', 'function' => 'thematic_single_insert', 'priority' => 10), 'Single Bottom' => array('admin_menu_order' => 1200, 'args' => array('name' => 'Single Bottom', 'id' => 'single-bottom', 'description' => __('The bottom widget area displayed on a single post.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_single_bottom', 'function' => 'thematic_single_bottom', 'priority' => 10), 'Page Top' => array('admin_menu_order' => 1300, 'args' => array('name' => 'Page Top', 'id' => 'page-top', 'description' => __('The top widget area displayed on a page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_page_top', 'function' => 'thematic_page_top', 'priority' => 10), 'Page Bottom' => array('admin_menu_order' => 1400, 'args' => array('name' => 'Page Bottom', 'id' => 'page-bottom', 'description' => __('The bottom widget area displayed on a page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_page_bottom', 'function' => 'thematic_page_bottom', 'priority' => 10));
    $thematic_widgetized_areas = apply_filters('thematic_widgetized_areas', $thematic_widgetized_areas);
    if (!function_exists('register_sidebars')) {
        return;
    }
    foreach ($thematic_widgetized_areas as $key => $value) {
        register_sidebar($thematic_widgetized_areas[$key]['args']);
        if (!has_action($thematic_widgetized_areas[$key]['action_hook'], $thematic_widgetized_areas[$key]['function'])) {
            add_action($thematic_widgetized_areas[$key]['action_hook'], $thematic_widgetized_areas[$key]['function'], $thematic_widgetized_areas[$key]['priority']);
        }
    }
    // we will check for a Thematic widgets directory and and add and activate additional widgets
    // Thanks to Joern Kretzschmar
    $widgets_dir = @dir(ABSPATH . '/wp-content/themes/' . get_template() . '/widgets');
    if ($widgets_dir) {
        while (($widgetFile = $widgets_dir->read()) !== false) {
            if (!preg_match('|^\\.+$|', $widgetFile) && preg_match('|\\.php$|', $widgetFile)) {
                include ABSPATH . '/wp-content/themes/' . get_template() . '/widgets/' . $widgetFile;
            }
        }
    }
    // we will check for the child themes widgets directory and add and activate additional widgets
    // Thanks to Joern Kretzschmar
    $widgets_dir = @dir(ABSPATH . '/wp-content/themes/' . get_stylesheet() . '/widgets');
    if (TEMPLATENAME != THEMENAME && $widgets_dir) {
        while (($widgetFile = $widgets_dir->read()) !== false) {
            if (!preg_match('|^\\.+$|', $widgetFile) && preg_match('|\\.php$|', $widgetFile)) {
                include ABSPATH . '/wp-content/themes/' . get_stylesheet() . '/widgets/' . $widgetFile;
            }
        }
    }
    // Remove WP default Widgets
    // WP 2.8 function using $widget_class
    if (function_exists('unregister_widget')) {
        unregister_widget('WP_Widget_Meta');
        unregister_widget('WP_Widget_Search');
        unregister_widget('');
        // pre WP 2.8 function using $id
    } else {
        unregister_widget_control('meta');
        unregister_widget_control('search');
    }
    // Finished intializing Widgets plugin, now let's load the thematic default widgets
    register_sidebar_widget(__('Search', 'thematic'), 'widget_thematic_search', null, 'search');
    unregister_widget_control('search');
    register_sidebar_widget(__('Meta', 'thematic'), 'widget_thematic_meta', null, 'meta');
    unregister_widget_control('meta');
    register_sidebar_widget(array(__('RSS Links', 'thematic'), 'widgets'), 'widget_thematic_rsslinks');
    register_widget_control(array(__('RSS Links', 'thematic'), 'widgets'), 'widget_thematic_rsslinks_control', 300, 90);
    // Pre-set Widgets
    $preset_widgets = array('primary-aside' => array('search', 'pages', 'categories', 'archives'), 'secondary-aside' => array('links', 'rss-links', 'meta'));
    if (isset($_GET['activated'])) {
        update_option('sidebars_widgets', apply_filters('thematic_preset_widgets', $preset_widgets));
    }
}
开发者ID:jentanbernardus,项目名称:Thematic-html5boilerplate,代码行数:58,代码来源:widgets-extensions.php


示例20: registerPageTemplate

 public function registerPageTemplate($atts)
 {
     $cache_key = 'page_templates-' . md5(get_theme_root() . '/' . get_stylesheet());
     $templates = empty(wp_get_theme()->get_page_templates()) ? [] : wp_get_theme()->get_page_templates();
     wp_cache_delete($cache_key, 'themes');
     $templates = array_merge($templates, $this->templates);
     wp_cache_add($cache_key, $templates, 'themes', 1800);
     return $atts;
 }
开发者ID:alpipego,项目名称:wp-nownownow,代码行数:9,代码来源:Plugin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_stylesheet_directory函数代码示例发布时间:2022-05-15
下一篇:
PHP get_strings函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap