#
Basic Shortcodes
This document will discuss the basic shortcodes, their attributes, and use case scenarios.
#
Admin Only
This shortcode specifies that the content inside of the [admin_only]
[/admin_only]
code should be shown on the backend. Developers may use this shortcode in conjunction with [non_admin_only]
[/non_admin_only]
shortcode to partition frontend and backend content and prevent them from interfering with one another. This shortcode has no attributes.
Shortcode:
[admin_only]
Code Example:
[admin_only]
hello backend
[/admin_only]
#
Non Admin
This shortcode specifies that the content inside of the [non_admin_only]
[/non_admin_only]
should be shown on the frontend. Developers may use this shortcode in conjunction with [admin_only]
[/admin_only]
shortcode to partition front end and backend content and prevent them from interfering with one another. This shortcode has no attributes.
Shortcode:
[non_admin_only]
Code Example:
[non_admin_only]
hello frontend
[/non_admin_only]
#
Get Asset File URL
This self-closing shortcode returns the URL path to the specified asset file in the database. Typically, this shortcode is used within an entry or repeater shortcode.
Attributes:
Shortcode:
[get_asset_file_url]
Code Example:
[entry]
<div class="blog-wrapper">
<h1></h1>
<img alt="[get_asset_file_name id=]" class="img-responsive" src="[get_asset_file_url id=]" />
<p></p>
</div>
[/entry]
#
Get Asset File Name
Returns the name of the specified asset file.
Attributes:
Shortcode:
[get_asset_file_name]
Code Example:
<div class="row">
<div class="col-md-8">
<img alt="[get_asset_file_name id=]" src="[get_asset_file_url id=]">
</div>
</div>
#
Print Date
Returns the date formatted according to PHP's date function.
Attributes:
Shortcode:
[print_date]
Code Example:
<div class="col-sm-8">
<h2></h2>
<span class="news-date">[print_date format="F d, Y g:ia" timestamp=""]</span>
</div>
#
Lower Case
Returns lowercased version of the string value within the enclosing shortcode. This shortcode has no attributes.
Shortcode:
[lower_case]
Code Example:
<a class="[lower_case][/lower_case]">
<img alt="[get_asset_file_url id=]" src="[get_asset_file_url id=]">
</a>
#
Report Errors
Enables PHP error messages and warning for development purposes. This self-closing shortcode contains no attributes.
Shortcode:
[report_errors]
Code Example:
[admin_only] [report_errors] [/admin_only]
#
No Spaces
Removes spaces from the content within the enclosing shortcode to make it database friendly. This shortcode contains no attributes.
Shortcode:
[no_spaces]
Code Example:
<a class="[no_spaces][/no_spaces]">
<img alt="Image" src="/images/logo.png">
</a>