(V5) What are shortcodes and how can I use them? Print

  • short codes, shortcodes
  • 3

Shortcodes can be used in your content pages, blog pages, and your product descriptions to simplify the process of adding extra features to your content - like displaying pop-up images or showing a YouTube video. If you've used the WordPress blogging platform before, then you've probably come across shortcodes as well as they're a very commonly used tool to add extra features to pages.

You enter a shortcode straight into your normal content by wrapping it in square brackets. The website software then processes the tag when the page gets displayed and replaces the shortcode with the content it represents. Shortcodes are written in lowercase letters so they can be separated from other types of content that might use square brackets in your text.

Examples of codes are [module_slideshow id=10 /], [login] [/login], [video type="youtube" id="dMis7LTpwwg" /]

You enter these straight into your content page at the appropriate place and the cart does the rest when the page is viewed by the customer.

 

Available shortcodes

Here is information on the shortcodes that are available in Ozcart that you can insert into your content pages, blog posts or product descriptions.

 

[logo width="200" height="200" bg="rrggbb"]
The logo shortcode inserts your store logo that you set up under the Config Menu in Store Settings > General Settings > Image. You can specify the size of the logo to display by adding a width and height setting to the shortcode. If you leave it plain as just [logo] the store logo is inserted at the same size it was uploaded.

[abn]
Inserts your business number into your content without you having to remember it. You can set up the business number under the Config Menu in Store Settings > General Settings > Store.

[store_address]
Inserts your business store address into your content without you having to re-type it. You can set up the Store Address under the Config Menu in Store Settings > General Settings > Store.

[store_phone]
Inserts your business store contact phone number into your content in pages, blog posts and product descriptions without you having to re-type it. You can set up the Store phone number under the Config Menu in Store Settings > General Settings > Store.

[store_email]
Inserts your business contact email address into your content in pages, blog posts or product descriptions, without you having to re-type it. You can set up the Store email address under the Config Menu in Store Settings > General Settings > Store.

[store_facebook]
Inserts a HTML text link to your store's Facebook page that you have set up in Store Settings > General Settings > Store - you can use it in landing pages, blog posts or even product descriptions.

[store_twitter]
Inserts a HTML text link to your store's Twitter feed that you have set up in Store Settings > General Settings > Store - you can use it in landing pages, blog posts or even product descriptions.

[store_instagram]
Inserts a HTML text link to your store's Instagram that you have set up in Store Settings > General Settings > Store - you can use it in landing pages, blog posts or even product descriptions.

[store_pinterest]
Inserts a HTML text link to your store's Pinterest board that you have set up in Store Settings > General Settings > Store - you can use it in landing pages, blog posts or even product descriptions.

[store_googleplus]
Inserts a HTML text link to your store's Google+ page that you have set up in Store Settings > General Settings > Store - you can use it in landing pages, blog posts or even product descriptions.

[store_social icons="facebook,twitter,pinterest,instagram" justtext="N"]
Inserts an icon link of your social media network(s) that you have set up in Store Settings > General Settings > Store - you can use it in landing pages, blog posts, or even product descriptions.

Learn more about how to social media text and icon shortcodes.

[wishlist_items]
Inserts the number of items currently in the wish list for the current customer. Can be used in the header section to insert up-to-date information into the text links there. Read this documentation to learn about how to add wishlist_items and a counter to your page.

[compare_items]
Inserts the number of items currently in the product comparison page. Can be used in the header section to insert up-to-date information into the text links there. Read this documentation to learn about how to add compare_items and a counter to your page.

[account_link text_account="My Account"]
Adds a link to the My Account page. If the visitor is not logged in, a link to the Login page is added. You can customize the text that appears in the list by adding the text_account='My custom text' part (where My custom text is the text that you want to display in the link).
Note for advanced users: if your custom text has quotation marks in it (e.g., if you are pasting HTML for example), make sure that the quotation marks surrounding the text are different from the ones inside the text, or the cart will not know where the text starts and finishes.
E.g.,
To have the text <span style="color: #f00">My Account</span> as your text you would enter the shortcode as [account_link text_account='<span style="color: #f00">My Account</span>']
i.e., single quotes surrounding the text, and quotation marks inside the text.

[register_link text_register="Register Now"]
Adds a link to the Account Registration page. If the visitor is already logged in, a link to the My Account page is added. You can customize the text that appears in the list by adding the text_register='Your custom text' part (where Your custom text is the text that you want to display in the link).
Note for advanced users: if your custom text has quotation marks in it (e.g., if you are pasting HTML for example), make sure that the quotation marks surrounding the text are different from the ones inside the text, or the cart will not know where the text starts and finishes.
e.g.,
To have the text <span style="color: #f00">Register</span> as your text you would enter the shortcode as [register_link text_account='<span style="color: #f00">Register</span>']
i.e. single quotes surrounding the text, and quotation marks inside the text.

[login_link text_login="Login" text_logout="Log Out"]
If the visitor is not logged in, this adds a link to the Login page. If the visitor is already logged in, a link to the Log Out page is added.
Note for advanced users: if your custom text has quotation marks in it (e.g., if you are pasting HTML for example), make sure that the quotation marks surrounding the text are different from the ones inside the text, or the cart will not know where the text starts and finishes.
e.g.,
To have the text <span style="color: #f00">Log in</span> as your login text you would enter the shortcode as [login_link text_login='<span style="color: #f00">Log in</span>']
i.e. single quotes surrounding the text, and quotation marks inside the text.

[button]
Need a quick way to add a button like the wish list button on the product page? You can use the button code to do this. The button shortcode wraps the text or link that you want to display on the button. You can use another shortcode inside the button text if you wish to create a direct link to a product or category, or a standard HTML link.

The Gallery page in the Ozcart demo has a shop now button that is created using the button shortcode. You can style it with CSS on your own website.

[link_product id="151" title="hover title"]link text[/link_product]
You can create a quick link to a product if you know the product identifier for your store's database. You can add an optional title that appears if someone hovers over the link. For detailed information about this code see the link a product shortcode reference article - it also includes instructions on how to find the product id for the product you want to link to.

[link_category id="355" title="hover title"]link text[/link_category]
You can create a quick link to a product category if you know the category identifier from the store's database. You can add an optional title that appears if someone hovers over the link. For detailed information about this code see the link a category shortcode reference article - it also includes instructions on how to find the category id for the category that you want to link to.

[link_brand id="11" title="hover title"]link text[/link_brand]
You can create a quick link to a brand or manufacturer page, so long as you know the brand's identifier number from your store's database. This is easy to obtain. You can also add an optional title that appears if someone hovers over the link. For detailed information about this code see the link to a brand shortcode reference article - it also includes instructions on how to find the brand's manufacturer id number for the brand/manufacturer page that you want to link to.

[link_info id="4" title="hover title"]link text[/link_info]
You can create a quick link to an information page like your store's terms and conditions, so long as you know the page's identifier number from your store's database. This is easy to obtain. You can also add an optional title that appears if someone hovers over the link. For detailed information about this code see the link to a brand shortcode reference article - it also includes instructions on how to find the brand's manufacturer id number for the brand/manufacturer page that you want to link to.

[view_products type="latest" limit="4" img_w="100" img_h="100" /]
Use this shortcode to insert a products block, filled with the latest products added.

[view_products type="featured" limit="4" img_w="100" img_h="100" /]
Use this shortcode to insert a products block, filled with the products you've featured.

[view_products type="special" limit="4" img_w="100" img_h="100" /]
Use this shortcode to insert a products block, filled with the products that are marked as on-special.

[view_products type="bestseller" limit="4" img_w="100" img_h="100" /]
Use this shortcode to insert a products block, filled with the best selling products in your store.

[module_slideshow id="10" img_w="1400" img_h="300" /]
To display a banner slideshow you have already set up, then use this shortcode to insert it into the right place in your HTML. Follow the instructions in our banner and slideshow shortcode article for more information on setting this up.

[login msg_login="Wholesalers - please <a href='%s'>log in</a> to view this next section." group="2"]content[/login]
If you want a paragraph of section of your page to be visible to a particular customer group (e.g., Wholesale) then wrap the hidden content inside the login shortcode. The content will only be shown if the specified group is logged in and viewing the page. It will be invisible to everyone else.

[one_quarter]content[one_quarter][one_quarter]second column[/one_quarter][one_quarter]thirdfourth column[/one_quarter][one_quarter]fourth column[/one_quarter]
Display chosen content in four columns (quarters)

[one_third]content[one_third][one_third]second column[/one_third][one_third]third column[/one_third]
Display chosen content in three columns (thirds)

[one_half]content[one_half][one_half]second column[/one_one_half]
Display chosen content in two columns (twos)

[customform]FORM ID NUMBER HERE[/customform]
Display a Custom Form form (e.g., contact us form). See our Custom Form article for more information and for more shortcodes.


Was this answer helpful?

« Back