[wordpress插件] Custom CSS and JS自定义CSS和JS

wordpress 插件 文章 2020-04-07 19:00 482 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Custom CSS and JS allows you to add stylesheets and JavaScripts to any

自定义CSS和JS 允许您将样式表和JavaScript添加到任何

individual post by adding custom fields.

通过添加自定义字段的单个帖子。

Both CSS and scripts can be either internal or external.

CSS和脚本都可以是内部的或外部的。

Since this is a plugin, the custom CSS and JavaScript are available to any theme used to display the post, as long as the themes call “wp_head”.

由于这是一个插件,因此自定义CSS和JavaScript可以用于显示帖子的任何主题,只要主题称为“ wp_head”即可。

Using the Plugin

使用插件

To use the plugin, add any combination of the following custom fields to your post.

要使用该插件,请将以下自定义字段的任意组合添加到您的帖子中。

custom_css

custom_css

Add an external stylesheet by adding a custom field with the name custom_css.

通过添加名称为 custom_css 的自定义字段来添加外部样式表。

The value of the field should be the path to your css file.

该字段的值应该是您的CSS文件的路径。

cusrom_css_code

cusrom_css_code

Add an internal stylesheet by adding a custom field with the name custom_css_code.

通过添加名称为 custom_css_code 的自定义字段来添加内部样式表。

Include your CSS code as the value.

包括您的CSS代码作为值。

(Do not include the style tags.)

(不包括样式标签。)

custom_js

custom_js

Add an external JavaScript by adding a custom field with the name custom_js.

通过添加名称为 custom_js 的自定义字段来添加外部JavaScript。

The value of the field should be the path to your script.

该字段的值应该是脚本的路径。

custom_js_code

custom_js_code

Add an internal JavaScript by adding a custom field with the name custom_js_code.

通过添加名称为 custom_js_code 的自定义字段来添加内部JavaScript。

Include your JavaScript code as the value.

包括您的JavaScript代码作为值。

(Do not include the script tags.)

(不包括脚本标签。)

Custom Fields Order

自定义字段顺序

    1. The external styles and scripts are included before the internal ones.
    2. 外部样式和脚本先于内部样式和脚本。

    3. If you include multiple entries for a given field, the entries will be included in order.
    4. 如果您在给定字段中包含多个条目,则这些条目将按顺序包含。

    Okay, but what if I don’t like those tags?

    好的,但是如果我不喜欢那些标签怎么办?

    Just edit custom-css-js.php and change the constants defined near the top of the file.

    只需编辑custom-css-js.php并更改文件顶部附近定义的常量。

    Note

    注意

    This plugin only works with individual posts and pages.

    此插件仅适用于单个帖子和页面。

    It does not work for list pages (e.g., the index page, search results).

    不适用于列表页面(例如索引页面,搜索结果)。

安装步骤

    1. Unpack the download package.
    2. 解压缩下载包。

    3. Upload folder to the “/wp-content/plugins/” directory
    4. 将文件夹上传到“ / wp-content / plugins /”目录

    5. Activate the plugin through the “Plugins” menu in WordPress
    6. 通过WordPress中的“插件”菜单激活插件

下载地址
https://downloads.wordpress.org/plugin/custom-css-and-js.zip
-EOF-

AI助手支持GPT4.0