當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。