Shortcodes
Is a comprehensive collection of various visual and functional elements, which you can use in the post editor, text widgets or even in template files.
Usage
The Shortcode API makes it easy to create shortcodes that support attributes like this:
<?php echo do_shortcode( '[aios_responsive_image id="99"]' ); ?>
OR
<?php echo do_shortcode( '[ai_phone href="+1.800.979.5799"]Call 800.979.5799[/ai_phone]' ); ?>
Bloginfo
Displays information about the current site.
[bloginfo show="name"]
Attributes:
- show - Site information to display. Default: name
Possible values for $show
- ‘name’ – Displays the
Site Title
set in Settings > General. - ‘description’ – Displays the
Tagline
set in Settings > General. - ‘wpurl’ – Displays the
WordPress address (URL)
set in Settings > General. - ‘url’ – Displays the
Site address (URL)
set in Settings > General. - ‘admin_email’ – Displays the
E-mail address
set in Settings > General. - ‘charset’ – Displays the
Encoding for pages and feeds
set in Settings > Reading. - ‘version’ – Displays the WordPress Version you use.
- ‘html_type’ – Displays the Content-Type of WordPress HTML pages (default:
text/html
). - ‘text_direction’ – Displays the Text Direction of WordPress HTML pages.
- ‘language’ – Displays the language of WordPress.
- ‘stylesheet_url’ – Displays the primary CSS (usually style.css) file URL of the active theme.
- ‘stylesheet_directory’ – Displays the stylesheet directory URL of the active theme. (Was a local path in earlier WordPress versions.)
- ‘template_url’ / ‘template_directory’ – URL of the active theme’s directory.
- ‘pingback_url’ – Displays the Pingback XML-RPC file URL (xmlrpc.php).
- ‘atom_url’ – Displays the Atom feed URL (/feed/atom).
- ‘rdf_url’ – Displays the RDF/RSS 1.0 feed URL (/feed/rfd).
- ‘rss_url’ – Displays the RSS 0.92 feed URL (/feed/rss).
- ‘rss2_url’ – Displays the RSS 2.0 feed URL (/feed).
- ‘comments_atom_url’ – Displays the comments Atom feed URL (/comments/feed).
- ‘comments_rss2_url’ – Displays the comments RSS 2.0 feed URL (/comments/feed).
- ‘siteurl’ – Display the site URL.
- ‘home’ – Display the home URL.
Custom Banner
Returns set of data for custom banner
[aios_custom_banner]
<div className="ip-banner" data-type="[post_type]" data-id="[post_id]">
<canvas width="1600" height="350" style="background-image: url([banner_image])"></canvas>
<div className="container">
<div className="row">
<div className="col-md-12">
<h1 className="entry-title">
[title]
<span>[sub_title]</span>
</h1>
</div>
</div>
</div>
</div>
[/aios_custom_banner]
Inline shortcodes:
- [title] - If custom title is enabled this will return the custom title else the post title.
- [sub_title] - If custom title is enabled this will return the custom sub title else empty.
- [banner_image] - Return image url depends on the size that you selected from the backend.
- [post_type] - Return post type, and taxonomy type.
- [post_id] - Return post id, and taxonomy id.
- [post_id] - Return post id, and taxonomy id.
- [banner_alternative_text] - If a specific page declaration is empty, attachment alt will be declared.
- [banner_title] - If a specific page declaration is empty, attachment title will be declared.
How to migrate to widgetize banner?
Here’s the code use in the video:
if ( ! is_home() && !is_page_template( 'template-homepage.php' ) && is_custom_field_banner( get_queried_object() ) && is_active_sidebar('aios-inner-pages-banner')) {
dynamic_sidebar('aios-inner-pages-banner');
}
Full PHP Code
Here’s a copy of basic PHP for the custom banner:
if ( ! is_home() && !is_page_template( 'template-homepage.php' ) && is_custom_field_banner( get_queried_object() ) ) {
$aios_metaboxes_banner_title_layout = (int) get_option( 'aios-metaboxes-banner-title-layout', '' );
$aioscm_default_banner = get_option( 'aios-metaboxes-default-banner-image', '' );
$aioscm_default_banner_size = get_option( 'aios-metaboxes-default-banner-size', 'full' );
if( ! is_null( get_queried_object()->post_type ) ) {
$aioscm_used_custom_title = get_post_meta( get_queried_object()->ID, 'aioscm_used_custom_title', true );
$aioscm_main_title = get_post_meta( get_queried_object()->ID, 'aioscm_main_title', true );
$aioscm_sub_title = get_post_meta( get_queried_object()->ID, 'aioscm_sub_title', true );
$default_title = get_the_title( get_queried_object()->ID );
$aioscm_title = $aioscm_used_custom_title == 1 ? '<h1 className="entry-title">' . $aioscm_main_title . '<span>' . $aioscm_sub_title . '</span></h1>' : '<h1 className="entry-title">' . $default_title . '</h1>';
$aioscm_banner_id = get_post_meta( get_queried_object()->ID, 'aioscm_banner', true );
$aioscm_banner_id = !empty( $aioscm_banner_id ) ? $aioscm_banner_id : $aioscm_default_banner;
$aioscm_banner = ( !empty( $aioscm_banner_id ) ? 'style="background-image: url(' . wp_get_attachment_image_url( $aioscm_banner_id, $aioscm_default_banner_size ) . ');"' : '' );
echo '<div className="ip-banner" data-post-type="' . get_queried_object()->post_type . '" data-id="' . get_queried_object()->ID . '">
<canvas width="1600" height="350" ' . $aioscm_banner . '></canvas>
' . ( $aios_metaboxes_banner_title_layout === 1 ? '<div className="container"><div className="row"><div className="col-md-12">' . $aioscm_title . '</div></div></div>' : '' ) . '
</div>';
} elseif ( ! is_null( get_queried_object()->taxonomy ) ) {
$taxonomy_id = get_queried_object()->term_id;
$taxonomy_name = get_queried_object()->name;
$taxonomy_meta = get_option( "term_meta_" . $taxonomy_id );
$aioscm_title = $taxonomy_meta['used_custom_title'] == 1 ? '<h1 className="entry-title">' . $taxonomy_meta['main_title'] . '<span>' . $taxonomy_meta['sub_title'] . '</span></h1>' : '<h1 className="entry-title">' . $taxonomy_name . '</h1>';
$aioscm_banner_id = $taxonomy_meta['banner'];
$aioscm_banner_id = !empty( $aioscm_banner_id ) ? $aioscm_banner_id : $aioscm_default_banner;
$taxonomy_banner = ( !empty( $aioscm_banner_id ) ? 'style="background-image: url(' . wp_get_attachment_image_url( $aioscm_banner_id, $aioscm_default_banner_size ) . ');"' : '' );
echo '<div className="ip-banner" data-taxonomy-name="' . $taxonomy_name . '" data-taxonomy-id="' . $taxonomy_id . '">
<canvas width="1600" height="350" ' . $taxonomy_banner . '></canvas>
' . ( $aios_metaboxes_banner_title_layout === 1 ? '<div className="container"><div className="row"><div className="col-md-12">' . $aioscm_title . '</div></div></div>' : '' ) . '
</div>';
} elseif( is_404() ) {
echo '<div className="ip-banner" data-post-type="404-not-found" data-id="404-not-found">
<canvas width="1600" height="350" style="background-image: url(' . wp_get_attachment_image_url( $aioscm_default_banner, $aioscm_default_banner_size ) . ');"></canvas>
</div>';
}
}
FAQs
It is possible to add different shortcode inside custom banner that is not included on list inline shortcodes?
- Yes
Introduced from version 5.1.8
Responsive Images
Returns set of adaptive images.
[aios_responsive_image id="99"]
Attributes:
- id - Image ID . Default: empty(required)
- sizes - Sizes separated by commas(viewport is required). Default: medium,medium_large,large,full. Default: 400,768,1024
- viewport - Width of monitor where to change the image sizez separated by commas(viewport is required). Default: 400,768,1024
- id_name - ID attribute for img element
- className - className attribute for img element. Default: img-responsive
- alt - Use for custom alt, if empty this will get alt from upload images. Default: Image Alt
- lazyload - Lazyload srcset. Default: falses
Introduced from version 4.1.0
Quick Search
Enable quick search under “Quick Search”
Select City Autocomplete
Returns autocomplete select using bootstrap.
[aios_quick_search_autocomplete]
Attributes:
- id - list of value accepted(city, zip, neighborhood, mlsarea). Default: Selected Area Type
- name - NAME Attribute of select tag. Default: Selected Area Type
- className - className Attribute of select tag. Default: empty
- placeholder - Default: Selected Area Type
- status_placeholder - Default: Start typing a {selected data types}
Property Type
Returns list of property type.
[aios_quick_search_property_type]
Attributes:
- id - ID Attribute of select tag. Default: property-type
- name - NAME Attribute of select tag. Default: propertyType
- className - className Attribute of select tag. Default: empty
- placeholder - Default: Select Property Type
- use_ihf_default - if set to true this will not use attribute “types”. Default: false
- types - Display lists of property type.
- Use double arrow operator ”=>” for value and display text, separator ”|” for new option
- Default:
- commercial=>Commercial
- condo-coop=>Condo/coop
- investment=>Investment
- land=>Land
- mobile-manufactured=>Mobile/manufactured
- residential=>Residential
- single-family=>Single Family
- townhouse=>Townhouse
- vacation=>Vacation
Beds
Returns number of beds.
[aios_quick_search_beds]
Attributes:
- id - ID Attribute of select tag. Default: beds
- name - NAME Attribute of select tag. Default: bedrooms
- className - className Attribute of select tag. Default: empty
- placeholder - Default: Beds
- min - minimum number of beds. Default: 1
- max - maximum number of beds. Default: 20
Baths
Returns number of baths.
[aios_quick_search_baths]
Attributes:
- id - ID Attribute of select tag. Default: baths
- name - NAME Attribute of select tag. Default: bathCount
- className - className Attribute of select tag. Default: empty
- placeholder - Default: Baths
- min - minimum number of beds. Default: 1
- max - maximum number of beds. Default: 20
- halfbath - if set to true this will return number with 0.5 increment. Default: false
Price
Returns list of prices.
[aios_quick_search_price]
Attributes:
- id - ID Attribute of select tag. Default: price
- name - NAME Attribute of select tag. Default: empty(but maxListPrice will be added)
- is_min_price - for iHomefinder if true name will change to “minListPrice” else “maxListPrice”. Default: maxListPrice
- className - className Attribute of select tag. Default: empty
- placeholder - Default: Price
- prices - List of prices.
- Use separator ”|” to seperate prices
- Default: 100000|300000|500000
- For price range add hyphen ”-” sample attribute: 100000-200000|300000-400000|500000-600000
- currency - Current to used. Default: $
Introduced from version 3.0.5
Site URL
Returns the site’s URL
[blogurl]
Introduced from version 1.5.0
Current URL
Returns the current page url
[current_url]
Introduced from version 1.5.0
Phone Number
Returns the em formartted phone number URL (e.g. Call 1.800.979.5799 )
[ai_phone href="+1.800.979.5799"]Call 800.979.5799[/ai_phone]
Attributes:
- filter - the script automatically adds ’.’ between the numbers. Set this to ‘false’ to disable. Default is true
- href - exact phone number details as long as it contains 10 or 11 digits number excluding special characters and spaces. For country code you are require to add plus sign(+). Smaple format: +1.123.456.7890
- extension - extension number can up to 4 digits
- convert_js - Display as anchor tag instead of appeding via javascript. Default is false
- unwrap_em - Unwrap anchor tag, condition convert_js must be true. Default is false
- className - className of the anchor tag, condition convert_js must be true.
Introduced from version 2.3.9
Child Theme URL
Returns the child theme URL (e.g. http://www.mysite.com/wp-content/themes/my-custom-theme ).
[stylesheet_directory]
Introduced from version 1.5.0
Parent Theme URL
Returns the parent theme URL(e.g. http://www.mysite.com/wp-content/themes/aios-starter-theme ).
[template_directory]
Introduced from version 1.5.0
Credits
Returns AgentImage credits
[agentimage_credits credits="Real Estate Website Design by <a target="_blank" href="https://www.agentimage.com" style="text-decoration:underline;font-weight:bold">Agent Image</a>"]
Attributes:
- credits - HTML of the credits
- renew - true or false, replace the current save credits.
- seo - true or false, SEO credits.
Introduced from version 1.5.0
Sitemap
Outputs an alphabetical list of pages in the site
[sitemap]
Attributes:
- expiration - Cache expiration in days. Default: 3
- refresh - Bypasss cache, it is recommend to remove the said attribute after you update the cache. Default: false Everything supported by the wp_list_pages() function
Introduced from version 1.5.0
AIOS Sitemap
Outputs a list of pages, communities, roadmaps(v3), and optional(categories) in the site
[aios_sitemap]
Attributes:
- expiration - Cache expiration in days. Default: 3
- refresh - Bypasss cache, it is recommend to remove the said attribute after you update the cache. Default: false
- show_categories - Display Categories. Default: false Everything supported by the wp_list_pages() function
Introduced from version 6.0.0
Custom Sitemap
Output all posts/pages/custom post type
[custom_sitemap]
You need to enable this module under Advanced->Settings check “Custom Sitemap”
Attributes:
- exclude_post_type - Will not include post type. Default: ”.
- exclude_ids - Will not include posts/pages/custom post type with match ID. Note that if is a parent child will be also hide. Default : ”
- orderby - Designates the ascending or descending order of the ‘orderby’ parameter accepted value “ASC”, “DESC”. Default: “ASC”
- order - Sort retrieved posts by parameter accepted value “ID”, “author”, “title”, “name”, “date”, “modified”, “parent”, “rand”, “comment_count”, “menu_order”, “meta_value”, “meta_value_num”, “title menu_order”, “post__in”. Default: “Title”
- orderby_child - Designates the ascending or descending order of the ‘orderby’ parameter accepted value “ASC”, “DESC”. Default: “ASC”
- order_child - Sort retrieved posts by parameter accepted value “ID”, “author”, “title”, “name”, “date”, “modified”, “parent”, “rand”, “comment_count”, “menu_order”, “meta_value”, “meta_value_num”, “title menu_order”, “post__in”. Default: “Title”
Introduced from version 3.0.0
Custom Sitemap with Taxonomy
Output all posts/pages/custom post type/taxonomies
[custom_sitemap_taxonomy]
You need to enable this module under Advanced->Settings check “Custom Sitemap”
Attributes:
- exclude_post_type - Will not include post type. Default: ”.
- exclude_ids - Will not include posts/pages/custom post type with match ID. Note that if is a parent child will be also hide. Default : ”
- exclude_tax_type - Will not include taxonomies. Default: ”.
- exclude_term_ids - Will not include terms with match ID. Default : ”
- order - Order by title. Default: “ASC”
Introduced from version 3.0.0
Navigation
Outputs a list of pages based on the main site navigation.
[wp_nav_menu]
Everything supported by the wp_nav_menu() function
Attributes:
- submenu - Only display the contents of the submenu under a navigation item
Introduced from version 2.0.0
Current Year
Set Dynamic Year.
[currentYear]
Attributes:
- currentYear - Set Current Year
Introduced from version 1.5.0
Email Address
Obfuscates an email address to help reduce spam.
[mail_to email="[email protected]"][email protected][/mail_to]
Attributes:
- email - an email address
- className - className of the anchor tag
Introduced from version 1.5.0
Video Placeholder
Default video placeholder for AI sites.
[agentimage_video width="560" height="315"]
Attributes:
- width - width of video
- height - height of video
Introduced from version 3.0.0
Asynchronous Iframe
Asynchronous load.
[iframe_async src="http://agentimage.com/" width="800" height="400"]
Attributes:
- width - width of iframe
- height - height of iframe
- id - id of iframe
- className - className of iframe
- additional - additional attribute for the iframe( i.e. additional=“frameborder=0 sandbox=allow-forms scrolling=yes” )
Introduced from version 3.0.0
Mortgage Calculator
Adds a mortgage calculator any page or widget.
[aios-mortgage-calculator years="5" interest="5.5" tax="10" insurance="500"]
Attributes:
- years - loan duration. Default: 5
- interest - interest rate. Default: 5.5
- tax - annual property tax. Default: 10
- insurance - annual insurance. Default: 500
Introduced from version 1.5.0
Image URL
This will display siteurl or theme dir.
[aios_element]
<div className="classes" style="background-image: url({{theme_dir}}/images/sample.jpg)"></div>
[blogurl]
<a href="[blogurl]"><img src="{{blogurl}}/wp-content/themes/theme_name/images/test.jpg" alt=""></a>
[/aios_element]
Inline Attributes:
{{theme_dir}}
- Return Stylesheet Directory URI{{blogurl}}
- Return Site URL
Attributes:
- element - HTML Element
- className - className
- width - Width
- height - Height
- style - style
- data-src - for lazy load use
- data-className - for lazy load use
- data-animation - for lazy load use
- data-offset - for lazy load use
Introduced from version 3.3.0
Display Current Date
Display current day
[date_day]
Display current year
[date_year]
Display current month
[date_month]
Display current date as YYYY-MM-DD
[date_yyyymmdd]
Display current month and year
[date_monthyear]
AIOS Menu
<?php
echo do_shortcode('[aios_menu sort_column="menu_order" theme_location="primary-menu" menu_id="nav"]');
?>
AIOS Image
[aios_image id="1"]
Attributes:
- id - attachment ID
- return - return type: [html, src] (default: html)
- element - shortcode element: [img, div, canvas] (default: img)
- width - image width (returns image source width if left empty)
- height - image height (returns image source height if left empty)
- alt - image custom alt (returns image alt if left empty)
- className - element className (separated by space)
- lazyload - image lazyload: [true, false] (default: true)
- placeholder - placeholder image for lazyload
Real Scout
Parse RS listings
To generate a shortcode, go to:
/wp-admin/admin.php?page=aios-integrations&panel=realscoutbeta
under the Listings Shortcode Generator section.
Sample Shortcode:
[aios_realscout_v2 append-to-id="fs-lists" limit="10" type="office" sort-order="STATUS_AND_SIGNIFICANT_CHANGE" listing-status="For Sale,For Rent,In Contract,Sold,Rented" property-types="SFR,MF,TC,LAL,MOBILE,OTHER" disable-shadow-dom]
<div id="fs-lists">
<div data-rs-item>
<img src="{{image}}">
<div className="skeleton-loader">{{price}}</div>
<div>{{beds}}</div>
<div>{{baths}}</div>
<div>{{area}}</div>
<a href="{{permalink}}">{{fullAddress}}</a>
</div>
</div>
Inline Attributes
Atrributes | Description |
---|---|
{{permalink}} | returns listing url/permalink |
{{fullAddress}} | returns listings full address |
{{street}} | returns listings street |
{{city}} | returns listings city |
{{zipcode}} | returns listings zipcode |
{{price}} | returns listings price |
{{beds}} | returns listings beds |
{{baths}} | returns listings baths |
{{area}} | returns listings sqft |
{{image}} | returns listings image |
Skeleton Loader:
If you need a skeleton loader effect, duplicate the data-rs-item
element according to the limit
value.
- Add the className “skeleton-loader” to the necessary elements and define its styling in your CSS.
- The “skeleton-loader” className will be automatically removed once the data is appended.
Attributes:
append-to-id
(Required) – A unique ID used when parsing listings for custom design. (Default: empty)limit
– Specifies the number of listings to display. (Default: 10)
Event Listener:
Once data is appended to the HTML, the following event is triggered:
Vanilla:
document.getElementById("fs-lists").addEventListener("realscoutListings", (event) => {
console.log(evt.detail);
});
jQuery:
jQuery(document).on("realscoutListings", "#fs-lists", function(evt) {
console.log(evt.originalEvent.detail);
});
The #fs-lists
is the ID you added to the attribute append-to-id
and the evt.originalEvent.detail
object contains the container ID and listings data, which can be used for additional functionalities like triggering a carousel.