[wordpress插件] COP CSS Custom Post Type LiteCOP CSS自定义帖子类型精简版

wordpress 插件 文章 2020-04-02 17:10 447 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Adds a custom post type of css that will compile all entries into a single minified css file that will automatically be enqueued to your site.

添加自定义帖子类型的CSS,它将所有条目编译到一个缩小的CSS文件中,该文件将自动进入您的网站。

Minified CSS is stored in a transient for caching.

缩小的CSS会存储在瞬态中以便缓存。

User now needs ‘edit_themes’ permission to see the css editor.

用户现在需要具有“ edit_themes”权限才能查看CSS编辑器。

By default this is only the administrator.

默认情况下,这仅是管理员。

Shortcodes

简码

Shortcodes are now processed during compilation of your css.

现在可以在编译CSS时处理短代码。

An new shortcode has been added called:

已添加一个新的简称:

[meta key=”(name of arbitrary custom field)” post_id=”(optional)”]

[meta键=”(任意自定义字段的名称)” post_id =”(可选)”]

This allows you to define a whatever custom fields you like on an individual css post and use them in your css.

这使您可以在单个CSS帖子中定义所需的任何自定义字段,并在CSS中使用它们。

Ex.

例如

a { color: [meta key=”my_color”];

{{color:[meta key =“ my_color”];

}

}

So you can define common elements and use them throughout your css.

因此,您可以定义通用元素并在整个CSS中使用它们。

If you like you can use the option post_id to put those values from another post.

如果愿意,可以使用选项post_id来放置来自其他帖子的那些值。

So you can have one master css post with your primary colors and such and referance it in other posts.

因此,您可以在主CSS帖子中写上您的原色等,并在其他帖子中引用它。

Credits

信用

Minification code from http://www.lateralcode.com/css-minifier/

http://www.lateralcode.com/css-minifier/ 中的缩小代码

Notes on Function

功能说明

All css is compiled on save unless the transient has expired.

除非临时状态已过期,否则所有css均在保存时编译。

If which case a query is run to compile the css durning rendering.

如果是这种情况,将运行查询以编译css裁切渲染。

I may add option to use either a wp_option or a transient based upon user preferance.

我可以根据用户的喜好添加使用wp_option或瞬态的选项。

Css is compiled by menu_order.

Css由menu_order编译。

I would like to add more options for better sorting.

我想添加更多选项以更好地进行排序。

There is an options page that outputs the css into a textarea so that you can review the final css in the dashboard.

有一个选项页面,可将css输出到文本区域,以便您可以在仪表板中查看最终的css。

Email me to request customizations trevor@mailagc.com

给我发送电子邮件以请求自定义 trevor@mailagc.com

Future options may also include the ability to write your css to your theme directory.

将来的选项还可能包括将CSS写入主题目录的功能。

This plugin currently must be active to keep the css available.

该插件当前必须处于活动状态,以保持CSS可用。

I’m trying to follow the path of Mark Jaquith.

我正在尝试追随Mark Jaquith的足迹。

Read more here.

在此处了解更多信息。

How to Write a Plugin I

如何编写插件

'll use

'将使用

安装步骤

Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the Plugin from Plugins page.

解压缩该zip文件,然后将其内容拖放到WordPress安装的wp-content / plugins /目录中,然后激活“来自插件的插件”页面。

下载地址
https://downloads.wordpress.org/plugin/cop-css-custom-post-type-lite.zip
-EOF-

AI助手支持GPT4.0