C9变量 strong>在所有这些领域以及更多领域都有帮助。It facilitates authoring reusable content as variables.
它有助于将可重用内容创作为变量。
Then, you can refer to these variables from other content (such as, blog post or page) instead of repeating the content.
然后,您可以从其他内容(例如博客文章或页面)中引用这些变量,而不必重复这些内容。
C9 Variables will automatically show the latest content of variables when the post or page is loaded.
C9变量 strong>将在加载帖子或页面时自动显示变量的最新内容。If you need to make updates, simply update the variable in one place and the changes will be available automatically when the referring page or post is reloaded.
如果您需要进行更新,只需在一个地方更新变量,当重新加载引荐页或帖子时,更改将自动可用。 p>
Here are some examples.
这里有一些例子。 p>
Example#1: Variable for Product Features
示例1:产品功能变量 h4>
Lets say you want to create reusable content for managing your product features that you would like to show at multiple places on your site, such as, the product page, blog posts, etc.
假设您想创建可重复使用的内容来管理要在网站上多个位置显示的产品功能,例如产品页面,博客文章等。 p>
- Create a variable using C9 Variables, say
ProductFeatures
, with the following content.
- 使用 C9变量 strong>(例如
ProductFeatures code>)创建具有以下内容的变量。
html
html
- Create new content.
- 创建新内容。 li>
- Modify content.
- 修改内容。 li>
- Search content.
- 搜索内容。 li>
- Delete content.
- 删除内容。 li>
ul> code> li>
- Now you can refer to this variable from another post or page using the
c9-vars-insert
shortcode. - 现在,您可以使用
c9-vars-insert code>短代码从另一个帖子或页面引用此变量。For example, here is a blog post snippet referring to the above ProductFeatures
variable.
例如,这是一个博客文章片段,涉及上面的 ProductFeatures code>变量。
html
html
Welcome to the release of our latest product that offers the following key features.
欢迎使用我们的最新产品,该产品具有以下主要功能。
[c9-vars-insert name="ProductFeatures"]
[c9-vars-insert name =“ ProductFeatures”]
We are quite optimistic that this will help you tremendously in managing your site.
我们非常乐观,这将极大地帮助您管理网站。 code>
Notice how you did not have to repeat the entire list of features.
请注意,您不必重复整个功能列表。
Next time you add more to the feature list, you can simply update the ProductFeatures
variable and all the content using this variable will get the latest feature list when reloaded.
下次将更多内容添加到功能列表时,只需更新 ProductFeatures code>变量,使用该变量的所有内容在重新加载时将获得最新的功能列表。
li>
ul>
See Demo.
请参见演示。 p>
p>
>
Example#2: Variable for Managing Promotion Code
示例2:用于管理促销代码的变量 h4>
Lets say you constantly run promotion on your site and you have links from various pages and posts on your site that should provide the latest promotion code.
让我们说您经常在您的网站上运行促销活动,并且您的网站上有来自各个页面和帖子的链接,这些链接应提供最新的促销代码。
You want to ensure there are no obsolete promotion links.
您要确保没有过时的促销链接。
Here, you will create a variable to store the promotion code and use it from other content on your site.
在这里,您将创建一个变量来存储促销代码并从您站点的其他内容中使用它。
For the purpose of demonstration, lets use the promotion code value as CLOUDNINE
.
出于演示目的,让我们将促销代码值用作 CLOUDNINE code>。 p>- Create a variable, say
Promo Code
, with content as CLOUDNINE
. - 创建一个变量,例如
Promo Code code>,其内容为 CLOUDNINE code>。 li>- Refer to this variable wherever you would like to access the promotion code.
- 要访问促销代码的任何地方,请参考此变量。
Example
例子
html
html
Click here to claim your promotion code.
点击此处领取促销代码。 code>
/>
/>
Next time your promotion code changes, simply update the Promo Code
variable and all references will be updated dynamically.
下次您的促销代码更改时,只需更新促销代码 code>变量,所有引用就会动态更新。 li>
ul>
See Demo.
请参见演示。 p>
p>
>
Example#3: Variable for Site
示例#3:网站变量 h4>
Lets say you run a development site where you author your content first and then promote to production.
让我们说您经营一个开发网站,首先在其中创作您的内容,然后再推广到生产中。
This site contains links to other pages on your site.
该网站包含指向您网站上其他页面的链接。
When you promote this content to the production site, you want to make sure the links now refer to the production site without having to do a search and replace or other manual and error prone tasks.
当您将该内容推广到生产站点时,您要确保链接现在指向生产站点,而不必执行搜索和替换或其他手动和容易出错的任务。
C9 Variables makes this task simple.
C9变量 strong>使此任务变得简单。 p>- Create a variable for site, say
site
, with value as example-dev.local
in your development site. - 在开发站点中为站点创建一个变量,例如
site code>,其值为 example-dev.local code>。 li>- Create the same variable
site
with value as example.com
in your production site. - 在生产站点中创建与
example.com code>相同的变量 site code>。 li>- Now, you can author links in your content hassle free using the
site
variable. - 现在,您可以使用
site code>变量轻松编写内容中的链接。Example
例子
html
html
Click here to visit the MyCoolProduct.
单击此处以访问MyCoolProduct。
/blogs
/博客 code>
When this content is promoted to production, the links will be dynamically updated to use the production site
value.
当此内容被推广到生产环境时,链接将被动态更新以使用生产环境 site code>值。 li>
ul>
See Demo.
请参见演示。 p>
p>
>
Example#4: Nested Variables
示例#4:嵌套变量 h4>
Yes, variables can be nested!
是的,变量可以嵌套!
That is, one variable can refer to another variable.
即,一个变量可以引用另一变量。
In fact, a variable’s content can use shortcodes from other plugins as well.
实际上,变量的内容也可以使用其他插件的短代码。
Here’s an example.
这是一个例子。 p>
ul>
See Demo.
请参见演示。 p>
p>
>
Example#5: Variable for Magic Button!
示例5:魔术按钮变量! h4>
This is a common case of content management wherein the content is being actively developed in the development site for a particular release.
这是内容管理的常见情况,其中正在针对特定发行版在开发站点中积极开发内容。
The content is also published to production, but not made visible until the release date.
内容也会发布到生产中,但是直到发布日期才可见。
This is accomplished by using a variable to act as a magic button!
这是通过使用变量充当魔术按钮来完成的! p>
- Create a variable for magic button, say
Magic Button
, that uses the HTML div
tag and display
attribute. - 为魔术按钮创建一个变量,例如
Magic Button code>,该变量使用HTML div code>标签和 display code>属性。You can also use a version based name, such as, Magic Button V1.0
.
您还可以使用基于版本的名称,例如 Magic Button V1.0 code>。To keep the content visible on the development site, set Magic Button
variable value to the following.
为了使内容在开发站点上可见,请将 Magic Button code>变量值设置为以下值。
html
html
code> li>
- To keep the content hidden on the production site, set
Magic Button
variable value to the following.
- 要使内容隐藏在生产站点上,请将
Magic Button code>变量值设置为以下值。
html
html
code> li>
- Author the content.
- 编写内容。
Following is a sample content for demonstration purpose.
以下是用于演示目的的示例内容。
html
html
[c9-vars-insert name=’magic-button’]
[c9-vars-insert name ='magic-button']
This content shows the features of the latest release.
此内容显示了最新版本的功能。
div> code> li>
- Push content to production without a worry that it’ll be available to the users before the release date.
- 将内容推送到生产环境中,而不必担心在发布日期之前用户可以使用它们。 li>
- On the release date, simply switch the
Magic Button
variable value in production to make the content visible. - 在发布日期,只需在生产中切换
Magic Button code>变量值即可使内容可见。 li> ul>
See Demo.
请参见演示。 p>
p>
>
Example#6: Variable for Content Promotion
示例6:用于内容推广的变量 h4>
This is another common case in the documentation world and hence worth calling out.
这是文档世界中的另一种常见情况,因此值得一提。
Lets say you are preparing documentation for the next release of your product and you are working in a draft space that’s only accessible to select customers and employees.
假设您正在为产品的下一个版本准备文档,并且您正在的草稿空间 strong>中,只有特定的客户和员工可以访问。You want the links to point to the draft
space.
您希望链接指向草稿 code>空间。Once the product is released, you want to the links to dynamically point to the published
space.
产品发布后,您希望链接动态指向已发布 code>空间。 p>- Create a variable for space, say
space
, with value as draft
. - 为空间创建一个变量,例如
space code>,其值为 draft code>。 li>- Have your referring pages use the above variable when referring to the links.
- 让您的推荐页面在引用链接时使用上述变量。
For example
例如
html
html
Restricted page
限制页面
Documentation
文档
My Product Documentation
我的产品文档 code> li>
- Now, the select people with access to the above page will see the links that are pointing to the
draft
space. - 现在,有权访问上述页面的选定人员将看到指向
草稿 code>空间的链接。 li>- When you are ready for the release, you can simply update the
space
to published
and make the above restricted page publicly accessible. - 准备好发布时,只需将
space code>更新为 published code>,并使上面的受限制页面可以公开访问。And, all the content will be publicly available.
并且,所有内容将公开可用。
Simple!
很简单! li>
ul>
Keep building awesome reusable content!
继续构建很棒的可重用内容! p>
Features
功能 h3>
Basic Plugin Features
基本插件功能 h4>
C9 Variables is fully functional and it adds capabilities to both the WordPress Admin as well as the public interface.
C9变量 strong>具有全部功能,并且为WordPress Admin和公共界面添加了功能。 p>- WordPress Admin
- WordPress管理员
li>
- WordPress Public
- WordPress公共
- Replace Variable value when showing the post/page
- 显示帖子/页面时替换变量值 li>
ul>
li>
ul>
Pro Plugin Features
Pro插件功能 h4>
C9 Variables Pro provides following features on top of the basic plugin features.
C9 Variables Pro strong>在基本插件功能的基础上提供以下功能。 p>- WordPress Admin
- WordPress管理员
- Unlimited Variables
- 无限变量 li>
- Mark favorite Variables
- 标记喜欢的变量 li>
- Page/Post Editor Enhancements
- 页面/帖子编辑器增强功能
- Variable lookup supports searching by favorites
- 变量查找支持按收藏夹搜索 li>
- Variable lookup supports sorting results by Last Used or Title
- 变量查找支持按上次使用或标题对结果进行排序 li>
- Variable lookup supports pagination and configurable page size
- 可变查找支持分页和可配置页面大小 li>
ul>
li>
- Settings
- 设置
- Default Variable Sort Order: Title, Last Used (default: Title)
- 默认变量排序顺序:标题,最后使用(默认:标题) li>
- Number of Results per Page: 10, 25, 50 (default: 10)
- 每页结果数:10、25、50(默认值:10) li>
ul>
li>
ul>
li>
ul>
-EOF-
AI助手支持GPT4.0