[wordpress插件] Conditional Custom Fields Shortcode条件自定义字段简码

wordpress 插件 文章 2020-03-30 03:40 573 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

A series of shortcodes for using custom field values in pages or posts (or in sidebar widgets – via Section Widget

用于在页面或帖子(或边栏小部件)中使用自定义字段值的一系列简码-通过部分小部件

a>!), which would then allows you to take store the actual data in custom fields while storing the presentation in the page/post body.

a>!),这样您就可以将实际数据存储在自定义字段中,同时将演示文稿存储在页面/帖子正文中。

This transforms WordPress into an awesome CMS.

这将WordPress转换为超赞的CMS。

Keep reading for more inspirations.

继续阅读以获得更多灵感。

Basic Usage

基本用法

[cf "custom field name"]

  [cf“自定义字段名称”]

Example:

示例:

Picture of the day:

 当天图片:

This would output something like , assume the post/page has the custom field “picture-link” and

这将输出类似 的内容,假设该帖子/页面具有自定义字段“ picture-link”,并且

its value is “http://thesite.com/something.jpg”.

其值为“ http://thesite.com/something.jpg”。

That way, you (or your clients!) would never accidentally take out a div when updating your page because you won’t have to touch the page/post body anymore!

这样一来,您(或您的客户!)就不会在更新页面时意外删除div,因为您将不再需要触摸页面/帖子正文!

Default Values

默认值

[cf "custom field name" default="display this if the CF is undefined"]

  [cf“自定义字段名称” default =“如果未定义CF,则显示此内容”]

Example:

示例:

Contact [cf "support-email" default="support@mycompany.com"] if you have questions.

 如有疑问,请联系[cf“ support-email” default =“ support@mycompany.com”]。

support@mycompany.com will be displayed there if the custom field “support-email” is not present in that post/page.

如果该帖子/页面中没有自定义字段“ support-email”,则会显示

support@mycompany.com。

Simple Template

简单模板

[cf "custom field name" default="default value"]...template...[/cf]

  [cf“自定义字段名称” default =“默认值”] ...模板... [/ cf]

Example:

示例:

Price: [cf "price" default="Pricing information not available yet."] USD$%value% [/cf]

 价格:[cf“ price” default =“定价信息尚不可用。”] USD $%value%[/ cf]

If you cannot use %value% as your placeholder text for some reason, you can change it by specifying the placeholder attribute.

如果由于某种原因不能使用%value%作为占位符文本,则可以通过指定占位符属性来更改它。

Example:

示例:

Price: [cf "price" default="Pricing information not available yet."

 价格:[cf“ price” default =“定价信息尚不可用。” 

placeholder="__value__"] USD$__value__ [/cf]

placeholder =“ __ value__”] USD $ __ value__ [/ cf]

Multiple Values

多个值

It’s smart enough to do the right thing.

足够聪明,可以做正确的事情。

If your post has the following custom fields:

如果您的帖子具有以下自定义字段:

安装步骤

    1. Extract the zip file and drop the contents in the wp-content/plugins/ directory of your WordPress installation
    2. 解压缩zip文件并将其内容拖放到WordPress安装的wp-content / plugins /目录中

    3. Activate the Plugin from Plugins page
    4. 从“插件”页面激活插件

下载地址
https://downloads.wordpress.org/plugin/conditional-custom-fields-shortcode.zip
-EOF-

AI助手支持GPT4.0