Title: Custom Style
Author: merzedes
Published: <strong>2009 年 11 月 3 日</strong>
Last modified: 2010 年 2 月 25 日

---

搜索插件

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/custom-style.svg)

# Custom Style

 作者：[merzedes](https://profiles.wordpress.org/merzedes/)

[下载](https://downloads.wordpress.org/plugin/custom-style.1.0.2.zip)

 * [详情](https://cn.wordpress.org/plugins/custom-style/#description)
 * [评价](https://cn.wordpress.org/plugins/custom-style/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/custom-style/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/custom-style/#developers)

 [支持](https://wordpress.org/support/plugin/custom-style/)

## 描述

#### What is this plugin about?

You are using a theme in WordPress and it looks marvelous good. Well, almost! If
you could just change the main color to match your liking, your companys style, ..
whatever!

It’s actually easy in WordPress, because you have direct access to your themes’ 
style files. Just use `Appearance -> Editor` inside the Dashboard and there you 
go. That’s great until the other day you update your theme because a new, improved
and of course much better version has been released. Then all your custom changes
are gone and you have to start from scratch again.

A much better way is to save additional CSS rules in the blog’s database and include
them inside a `< style/>` element. Of course there must also be a way to enter those
rules via the Dahsboard. And this is exactly what this plugin is all about!

This simple plugin will add a `<style>..</style>` element to `<head />`, thus allowing
the administrator to customize the “look” of the theme used without actually changing
one of the theme’s files. This allows you to simply update the theme without loosing
your valueable changes.

#### Support

If you require any help, if something is not working, if you have an
 idea for improvement,
critics, please do not hesitate to contact me by sending an email to `wh [at] haefelinger[
dot] it` or visit the plugin’s home page at [http://workbench.haefelinger.it/project/custom-style](http://workbench.haefelinger.it/project/custom-style)

## 屏幕截图

[⌊Shows the additional menu item 'Custom-Style' showing up in
'Appearance' in your
Dashbard after having installed this plugin.⌉⌊Shows the additional menu item 'Custom-
Style' showing up in
'Appearance' in your Dashbard after having installed this plugin
.⌉[

Shows the additional menu item ‘Custom-Style’ showing up in ‘Appearance’ in your
Dashbard after having installed this plugin.

[⌊Shows the text input field with some example content and to the
right you can 
see what the plugin generates.⌉⌊Shows the text input field with some example content
and to the
right you can see what the plugin generates.⌉[

Shows the text input field with some example content and to the right you can see
what the plugin generates.

## 安装

#### Basic Installation

 1. Upload `custom-style` into `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress
 3. The plugin is now installed and ready for usage (see Usage section).

#### Usage

Once installed and activated, sub menu item ‘Custom Style’ is added to menu ‘Appearance’
in your Dashboard. Select that menu item, add some CSS rules into the text field
and save it. Then reload your WordPress Blog. If you then look at your blog’s HTML
source code, you should see a `<style>..</style>` element in the head element with
your content.

#### Advanced Usage

Depending on your CSS rules, you may need to refer to files in your theme. A typical
example is the usage of a background image as shown below:

    ```
        #header {
          background-image: url( <my theme url>/images/my-bg-image.jpg );
        }
    ```

Using a hardwired URL here is possible but a rather ugly solution. Especially if
you prefer to install themes having version numbers in their folder name.

To support a location independant CSS addition, ‘custom-style’ supports the syntax

    ```
         {bloginfo:word}
    ```

where ‘word’ is an arbitrary word (or absent). Such a ‘custom expression’ is evaluated
as

    ```
            bloginfo('word')
    ```

See https://codex.wordpress.org/Template_Tags/bloginfo for further information about‘
bloginfo’.

This eventually allows you to solve the problem above like

    ```
     #header {
       background-image: url({bloginfo:template_url}/images/my-bg-image.jpg );
     }
    ```

cause `bloginfo("template_url")` evaluates to your blog’s theme URL.

## 常见问题

  No <style>..</style> in my <head /> element?

The plugin depends on the usage of `<?php wp_head(); ?>`. So your
 header.php file
should look something like

    ```
           <head> .. <?php wp_head(); ?> .. </head>
    ```

  There is a <style>.. in my < element – no visible effect though!?

Make sure that your CSS styles are not overridden by `<style />`
 elements later
in your HTML code. It’s therefore advised to add `<?php wp_head(); ?> near </head
>, preferable

    ```
           <head> .. <?php wp_head(); ?></head>
    ```

Make also sure that your CSS rules are really picked up! It might very
 well be 
the case that your CSS rules are overriden by another CSS rules which is more selective!
Try to use the “!important” rule when in doubt.

## 评价

此插件暂无评价。

## 贡献者及开发者

「Custom Style」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ merzedes ](https://profiles.wordpress.org/merzedes/)

[帮助将「Custom Style」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/custom-style)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/custom-style/)，查看
[SVN仓库](https://plugins.svn.wordpress.org/custom-style/)，或通过[RSS](https://plugins.trac.wordpress.org/log/custom-style/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/custom-style/)。

## 更新日志

#### 1.0.2

 * No functional changes – just wrestling with this readme file. XML tags get eaten
   up by `markdown`, especially when using such a tag in a section’s title.

#### 1.0.1

 * No functional changes – spelling errors and ‘eaten-up-tags’ problem in readme.
   txt corrected. No changes in source code or functionality.
 * Bit of motivation why I created this plugin in the first placed got added to 
   readme.txt as well.

#### 1.0

 * Initial version.

## 额外信息

 *  版本 **1.0**
 *  最后更新：**16 年前**
 *  活跃安装数量 **40+**
 *  WordPress 版本 ** 2.0.2 或更高版本 **
 *  已测试的最高版本为 **2.9.2**
 *  语言
 * [English (US)](https://wordpress.org/plugins/custom-style/)
 * 标签
 * [admin](https://cn.wordpress.org/plugins/tags/admin/)[css](https://cn.wordpress.org/plugins/tags/css/)
 *  [高级视图](https://cn.wordpress.org/plugins/custom-style/advanced/)

## 评级

尚未提交反馈。

[Your review](https://wordpress.org/support/plugin/custom-style/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/custom-style/reviews/)

## 贡献者

 *   [ merzedes ](https://profiles.wordpress.org/merzedes/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/custom-style/)