This guide will help you understand and effectively use AriseAds dynamic shortcodes to enhance your website’s functionality and user experience.
What Are Dynamic Shortcodes?
Dynamic shortcodes are powerful tools that allow you to insert dynamic content into your WordPress posts, pages, or widgets without needing to write any code. They can display personalized messages, countdown timers, user information, and much more based on various conditions like user role, URL parameters, cookies, and device types.
Available Shortcodes
Countdown Shortcode
Description: Displays a countdown timer.
Usage:
[ariseads_countdown h="hours" m="minutes" s="seconds" loop="true|false" fallback="Message"]
Options:
h
(integer): Hours for the countdown. Default is0
.m
(integer): Minutes for the countdown. Default is0
.s
(integer): Seconds for the countdown. Default is0
.loop
(boolean): If set totrue
, the countdown restarts after reaching zero. Default isfalse
.fallback
(string): Message to display when the countdown ends ifloop
isfalse
.
Examples:
- Basic Countdown:
[ariseads_countdown h="1" m="30" s="0"]
Output: Displays01:30:00
counting down to zero. - Looping Countdown:
[ariseads_countdown h="0" m="5" s="0" loop="true"]
Output: Displays a countdown from00:05:00
and restarts after reaching zero. - Countdown with Fallback Message:
[ariseads_countdown h="0" m="0" s="10" fallback="Time's up!"]
Output: Counts down from00:00:10
and displays “Time’s up!” when finished.
User Info Shortcode
Description: Displays user-specific information such as country, flag, IP address, device type, or browser.
Usage:
[ariseads_user data="country|flag|ip|device|browser" fallback="Message"]
Options:
data
(string): Type of user information to display. Possible values:country
: Displays the user’s country name.flag
: Displays the user’s country flag emoji.ip
: Displays the user’s IP address.device
: Displays the type of device the user is using (e.g., desktop, mobile).browser
: Displays the user’s browser name.fallback
(string): Message to display if the requested data is unavailable.
Examples:
- Display Country Name:
[ariseads_user data="country"]
Output:United States
- Display Country Flag:
[ariseads_user data="flag"]
Output: 🇺🇸 - Display User IP Address with Fallback:
[ariseads_user data="ip" fallback="IP unavailable"]
Output:192.168.1.1
or “IP unavailable” if not available. - Display Device Type:
[ariseads_user data="device"]
Output:desktop
Date Shortcode
Description: Displays the current date in a specified format.
Usage:
[ariseads_date format="Date Format" fallback="Message"]
Options:
format
(string): PHP date format string. Common formats include:F j, Y
→July 25, 2024
Y-m-d
→2024-07-25
l, F j, Y
→Monday, July 25, 2024
fallback
(string): Message to display if the date is unavailable.
Examples:
- Default Date Format:
[ariseads_date]
Output:Jul 25, 2024
- Custom Date Format:
[ariseads_date format="Y-m-d"]
Output:2024-07-25
- Full Day and Month Name:
[ariseads_date format="l, F j, Y"]
Output:Monday, July 25, 2024
Time Shortcode
Description: Displays the current time in a specified format.
Usage:
[ariseads_time format="Time Format"]
Options:
format
(string): PHP time format string. Common formats include:H:i:s
→14:30:00
(24-hour format)g:i A
→2:30 PM
(12-hour format)H:i
→14:30
Examples:
- Default Time Format:
[ariseads_time]
Output:14:30:00
- 12-Hour Format with AM/PM:
[ariseads_time format="g:i A"]
Output:2:30 PM
- Hour and Minute Only:
[ariseads_time format="H:i"]
Output:14:30
Period Shortcode
Description: Displays a specific time period such as the current month, year, or day.
Usage:
[ariseads_period type="this_month|next_month|this_year|next_year|today|tomorrow" format="full|short"]
Options:
type
(string): The time period to display.this_month
: Current month.next_month
: Next month.this_year
: Current year.next_year
: Next year.today
: Current day of the week.tomorrow
: Next day of the week.format
(string): Display format.full
: Full name (e.g.,July
).short
: Abbreviated name (e.g.,Jul
).
Examples:
- Display Current Month in Full Format:
[ariseads_period type="this_month" format="full"]
Output:July
- Display Next Year in Short Format:
[ariseads_period type="next_year" format="short"]
Output:25
(Assuming the year is 2025) - Display Tomorrow’s Day in Full Format:
[ariseads_period type="tomorrow" format="full"]
Output:Tuesday
Login State Shortcode
Description: Displays content based on the user’s login state (logged-in user or guest).
Usage:
[ariseads_login state="user|guest" fallback="Message"]Content[/ariseads_login]
Options:
state
(string): The login state to target.user
: Content for logged-in users.guest
: Content for visitors who are not logged in.fallback
(string): Message to display if the condition is not met.
Examples:
- Content for Logged-In Users:
[ariseads_login state="user"]Welcome back![/ariseads_login]
Output for logged-in users:Welcome back!
- Content for Guests:
[ariseads_login state="guest"]Please log in[/ariseads_login]
Output for guests:Please log in
- Content with Fallback Message:
[ariseads_login state="user" fallback="Please log in"]Welcome back![/ariseads_login]
Output for guests:Please log in
User Role Shortcode
Description: Displays content based on the user’s role (e.g., administrator, editor).
Usage:
[ariseads_user_role role="role1,role2" fallback="Message"]Content[/ariseads_user_role]
Options:
role
(string): Comma-separated list of user roles.fallback
(string): Message to display if the user does not have the specified roles.
Examples:
- Content for Administrators:
[ariseads_user_role role="administrator"]Admin content[/ariseads_user_role]
Output for administrators:Admin content
- Content for Editors or Authors:
[ariseads_user_role role="editor,author"]Editor or author content[/ariseads_user_role]
Output for editors or authors:Editor or author content
- Content with Fallback for Non-Subscribers:
[ariseads_user_role role="subscriber" fallback="Upgrade to access"]Subscriber content[/ariseads_user_role]
Output for non-subscribers:Upgrade to access
URL Parameter Shortcode
Description: Displays content based on specific URL parameters.
Usage:
[ariseads_url_param param="parameter_name" value="parameter_value" fallback="Message"]Content[/ariseads_url_param]
Options:
param
(string): The name of the URL parameter to check.value
(string): The value of the parameter to match. If omitted, only the presence of the parameter is checked.fallback
(string): Message to display if the condition is not met.
Examples:
- Content When
source
Parameter Exists:[ariseads_url_param param="source"]Thanks for visiting![/ariseads_url_param]
Output when URL contains?source=anything
:Thanks for visiting!
- Content When
ref
Parameter Equalsemail
:[ariseads_url_param param="ref" value="email"]Thanks for coming from our email![/ariseads_url_param]
Output when URL contains?ref=email
:Thanks for coming from our email!
- Content with Fallback When
utm_campaign
Is Notsummer
:[ariseads_url_param param="utm_campaign" value="summer" fallback="Welcome!"]Summer sale content[/ariseads_url_param]
Output when URL doesn’t contain:?utm_campaign=summer
:Welcome!
Cookie Shortcode
Description: Displays content based on specific cookie values.
Usage:
[ariseads_cookie name="cookie_name" value="cookie_value" fallback="Message"]Content[/ariseads_cookie]
Options:
name
(string): The name of the cookie to check.value
(string): The expected value of the cookie. If omitted, only the presence of the cookie is checked.fallback
(string): Message to display if the condition is not met.
Examples:
- Content When
visited
Cookie Exists:[ariseads_cookie name="visited"]Welcome back![/ariseads_cookie]
Output whenvisited
cookie exists:Welcome back!
- Content When
user_type
Cookie Equalspremium
:[ariseads_cookie name="user_type" value="premium"]Premium content[/ariseads_cookie]
Output whenuser_type
cookie ispremium
:Premium content
- Content with Fallback When
language
Cookie Is Notes
:[ariseads_cookie name="language" value="es" fallback="Hello!"]Hola![/ariseads_cookie]
Output whenlanguage
cookie is notes
:Hello!
Browser Language Shortcode
Description: Displays content based on the user’s browser language.
Usage:
[ariseads_browser_language lang="lang1,lang2" fallback="Message"]Content[/ariseads_browser_language]
Options:
lang
(string): Comma-separated list of language codes (e.g.,en
,es
).fallback
(string): Message to display if the user’s browser language does not match any specified.
Examples:
- Content for English Browsers:
[ariseads_browser_language lang="en"]English content[/ariseads_browser_language]
Output for English browsers:English content
- Content for Spanish or French Browsers:
[ariseads_browser_language lang="es,fr"]Español o Français[/ariseads_browser_language]
Output for Spanish or French browsers:Español o Français
- Content with Fallback for Non-German Browsers:
[ariseads_browser_language lang="de" fallback="Please select your language"]Deutsch[/ariseads_browser_language]
Output for non-German browsers:Please select your language
Taxonomy Shortcode
Description: Displays content based on the current post’s taxonomy terms (e.g., categories, tags).
Usage:
[ariseads_taxonomy taxonomy="taxonomy_name" terms="term1,term2" fallback="Message"]Content[/ariseads_taxonomy]
Options:
taxonomy
(string): The taxonomy to check (e.g.,category
,post_tag
).terms
(string): Comma-separated list of terms within the taxonomy.fallback
(string): Message to display if the post does not belong to any of the specified terms.
Examples:
- Content for Posts in ‘News’ or ‘Updates’ Categories:
[ariseads_taxonomy taxonomy="category" terms="news,updates"]Latest information[/ariseads_taxonomy]
Output:Latest information
(if the post is in ‘news’ or ‘updates’ categories) - Content for Posts with ‘Featured’ Tag:
[ariseads_taxonomy taxonomy="post_tag" terms="featured"]Featured content[/ariseads_taxonomy]
Output:Featured content
(if the post has the ‘featured’ tag) - Content with Fallback for Products Not in ‘Sale’ Category:
[ariseads_taxonomy taxonomy="product_cat" terms="sale" fallback="Regular price"]On sale![/ariseads_taxonomy]
Output:Regular price
(if the product is not in the ‘sale’ category)
Schedule Shortcode
Description: Displays content based on various scheduling options like days of the week, specific dates, or time ranges.
Usage:
[ariseads_condition country="countries" visitor="visitor_type" device="devices" start="YYYY-MM-DD" end="YYYY-MM-DD" fallback="Message"]Content[/ariseads_condition]
Options:
country
(string): Comma-separated list of country codes (e.g.,US,CA
).visitor
(string): Visitor type (new
orreturning
).device
(string): Device types (mobile
,desktop
, etc.).start
(string): Start date inYYYY-MM-DD
format.end
(string): End date inYYYY-MM-DD
format.fallback
(string): Message to display if conditions are not met.
Examples:
- Content for Users in the US or Canada:
[ariseads_condition country="US,CA"]North American content[/ariseads_condition]
Output for users in US or Canada:North American content
- Content for Returning Visitors:
[ariseads_condition visitor="returning"]Welcome back![/ariseads_condition]
Output for returning visitors:Welcome back!
- Content for Mobile Users in July:
[ariseads_condition device="mobile" start="2023-07-01" end="2023-07-31"]Summer mobile promotion[/ariseads_condition]
Output for mobile users in July:Summer mobile promotion
Best Practices
- Use Clear and Descriptive Content: Ensure that the content within the shortcodes is clear and provides value to your users.
- Combine Shortcodes for Advanced Conditions: You can nest or combine shortcodes to create more personalized content experiences.
- Test Shortcodes Thoroughly: Before publishing, test your shortcodes to ensure they work as expected under different conditions.
- Keep Fallback Messages Meaningful: Always provide helpful fallback messages to guide users when conditions aren’t met.
Troubleshooting
Shortcodes Not Rendering:
Solution: Ensure that the plugin is activated. Also, verify that you’re using the correct shortcode syntax.
Incorrect Data Displayed:
Solution: Double-check the shortcode attributes and ensure they match the intended conditions or data.
Performance Issues:
Solution: Overusing complex shortcodes might affect page load times. Use them judiciously and optimize where possible.
Shortcodes Not Working on Widgets:
Solution: Ensure that your theme supports shortcodes in widgets. You might need to add do_shortcode
in widget areas if not already supported.