As a content author, you constantly try to keep the content on your site up-to-date. The challenge increases as many a times the same content is repeated at various places on your site. Add to that the content keeps changing over time making it more difficult to keep your site up-to-date. Here are some examples.
C9 Variables helps in all these areas and many more. 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. 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.
Here are some examples.
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.
ProductFeatures
, with the following content.html
<ul>
<li>Create new content.</li>
<li>Modify content.</li>
<li>Search content.</li>
<li>Delete content.</li>
</ul>
c9-vars-insert
shortcode. For example, here is a blog post snippet referring to the above ProductFeatures
variable.html
Welcome to the release of our latest product that offers the following key features.
[c9-vars-insert name="ProductFeatures"]
We are quite optimistic that this will help you tremendously in managing your site.
ProductFeatures
variable and all the content using this variable will get the latest feature list when reloaded. 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
.
Promo Code
, with content as CLOUDNINE
.html
<a href='http://example.com/product?coupon=[c9-vars-insert name="Promo Code"]'>Click here</a> to claim your promotion code.
Promo Code
variable and all references will be updated dynamically.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.
site
, with value as example-dev.local
in your development site.site
with value as example.com
in your production site.site
variable. Examplehtml
<a href='http://[c9-vars-insert name="site"]/products/MyCoolProduct'>Click here</a> to visit the MyCoolProduct.
<a href='http://[c9-vars-insert name="site"]'>/blogs</a>
site
value.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.
Nested Content
, that refers to the above ProductFeatures
variable with the following content.html
The following content is from the <strong>ProductFeatures</strong> variable.
[c9-vars-insert name=’productfeatures’]
Nested Content
variable is used, it will automatically substitute the content with the latest value for ProductFeatures
as well.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!
Magic Button
, that uses the HTML div
tag and display
attribute. You can also use a version based name, such as, Magic Button V1.0
. To keep the content visible on the development site, set Magic Button
variable value to the following.html
<div style="display: block;">
Magic Button
variable value to the following.html
<div style="display: none;">
html
[c9-vars-insert name=’magic-button’]
This content shows the features of the latest release.
</div>
Magic Button
variable value in production to make the content visible.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. You want the links to point to the draft
space. Once the product is released, you want to the links to dynamically point to the published
space.
space
, with value as draft
.html
Restricted page
<a href='http://example.com/documentation?space=[c9-vars-insert name="space"]'>Documentation</a>
<a href='http://example.com/documentation/myproduct/space=[c9-vars-insert name="space"]'>My Product Documentation</a>
draft
space.space
to published
and make the above restricted page publicly accessible. And, all the content will be publicly available. Simple!Keep building awesome reusable content!
C9 Variables is fully functional and it adds capabilities to both the WordPress Admin as well as the public interface.
C9 Variables Pro provides following features on top of the basic plugin features.