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


PHP WP_Theme::get_stylesheet_directory方法代码示例

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


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

示例1: resolveLanguagesPath

 public static function resolveLanguagesPath(\WP_Theme $theme)
 {
     // as taken from wp-includes/class-wp-theme.php:1114
     $path = $theme->get_stylesheet_directory();
     if ($domainpath = $theme->get('DomainPath')) {
         $path .= $domainpath;
     } else {
         $path .= '/languages';
     }
     return $path;
 }
开发者ID:sourcerer-mike,项目名称:wp-easy-translate,代码行数:11,代码来源:WpTheme.php

示例2: procreate

    /**
     * Runs the actual child theme creation functionality
     *
     * @global WP_Filesystem_Base $wp_filesystem
     *
     * @param string              $new_theme
     * @param WP_Theme            $template
     *
     * @throws Exception If the global filesystem object isn't available
     */
    public static function procreate($new_theme, WP_Theme $template)
    {
        /** @var WP_Filesystem_Base $wp_filesystem */
        global $wp_filesystem;
        if (!$wp_filesystem instanceof WP_Filesystem_Base) {
            if (!WP_Filesystem()) {
                throw new Exception(esc_html__('Could not access the filesystem!', 'child-themify'));
            }
        }
        $oldStylesheet = $template->get_stylesheet();
        $templateDirectory = untrailingslashit($template->get_stylesheet_directory());
        $oldName = $template->name;
        $new_theme_directory = trailingslashit(get_theme_root()) . sanitize_file_name(strtolower($new_theme));
        $wp_filesystem->mkdir($new_theme_directory);
        $newStylesheet = trailingslashit($new_theme_directory) . 'style.css';
        $wp_filesystem->touch($newStylesheet);
        $stylesheetContents = <<<EOF
/*
Theme Name: {$new_theme}
Version: 1.0
Description: A child theme of {$oldName}
Template: {$oldStylesheet}
*/

@import url("../{$oldStylesheet}/style.css");

EOF;
        $wp_filesystem->put_contents($newStylesheet, $stylesheetContents);
        if (file_exists("{$templateDirectory}/screenshot.png")) {
            $wp_filesystem->copy("{$templateDirectory}/screenshot.png", "{$new_theme_directory}/screenshot.png");
        }
        add_settings_error('', 'child-themify', esc_html__('Your child theme was created successfully.', 'child-themify'), 'updated');
    }
开发者ID:mbrozay,项目名称:fss_frontend-old-lostdatabase,代码行数:43,代码来源:legacy.php

示例3: loadFile

 private function loadFile($file, \WP_Theme $theme)
 {
     if (!is_file($file) || !preg_match('/\\.ya?ml$/', $file)) {
         return;
     }
     $theme_dir = $theme->get_stylesheet_directory();
     $theme_uri = $theme->get_stylesheet_directory_uri();
     $components_uri = WP_CONTENT_URL . '/components';
     ob_start();
     include $file;
     $content = ob_get_clean();
     try {
         $config = Yaml::parse($content);
         self::array_overwrite($this->configs, $config);
     } catch (ParseException $e) {
         trigger_error("Error while parsing {$file}: " . $e->getMessage(), E_USER_WARNING);
     }
 }
开发者ID:wemakecustom,项目名称:wp-config-manager,代码行数:18,代码来源:BaseManager.php


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