How to Use Shortcodes in WordPress (Quick Guide)

Please note, if you click and buy through links on our site, we may earn a small affiliate commission at no extra cost to you. Learn More

Shortcodes are small pieces of code that can be inserted into posts, pages, widgets, and other areas of your website to add various types of content, such as images, videos, galleries, forms, and more. In this quick guide, we will explore how to use shortcodes in WordPress and how they can help you create a more dynamic and engaging website.

Whether you’re a beginner or an experienced WordPress user, this guide will provide you with the essential knowledge to get started with shortcodes and take your website to the next level.

How to Add Shortcodes in Various Areas of WordPress

WordPress shortcodes allow you to quickly add dynamic content to your website, serving as shortcuts for executing specific functions. Here’s a step-by-step guide on how to add shortcodes to posts, pages, sidebar widgets, and theme files in WordPress:

Adding Shortcodes to Posts and Pages

  • Edit the post or page where you want to add the shortcode.
  • In the content editor, click on the ‘+’ icon to add a new block.
  • Search for and select the ‘Shortcode’ block.
  • Enter the desired shortcode within the brackets [ ], e.g.,

Adding Shortcodes to Sidebar Widgets

  • Navigate to Appearance > Widgets in your WordPress dashboard.
  • Press the “+” icon on the desired sidebar area.
  • Insert the shortcode within the brackets like earlier.

Adding Shortcodes to Theme Files:

  • Access your theme files via FTP or the WordPress theme editor (Appearance > Theme Editor).
  • Locate and open the desired file where you want to add the shortcode.
  • Insert the following PHP code where you want the shortcode to appear:

<?php echo do_shortcode(“[your_shortcode]”); ?>

  • Replace ‘[your_shortcode]’ with the actual shortcode you want to use.
  • Save the changes and check your site to ensure the shortcode is working correctly.

How to Add Shortcode to Classic Editor

If you’re using the Classic Editor in WordPress, follow the below steps to add shortcode:

  • First, open the post or page where you want to add the shortcode.
  • In the editing screen, position your cursor where you want to insert the shortcode.
  • Type or copy-paste the shortcode directly into the editor with the bracket in a new line.
  • Once you have inserted the shortcode, simply save or publish your post or page, and the shortcode will be executed and displayed on the front end of your website.

That’s all there is to it! Just remember to test your shortcode to ensure that it works correctly and that the content is displayed as intended. If you encounter any issues, double-check that the shortcode syntax is correct and that all necessary parameters and attributes are included.


Shortcodes are a powerful tool that can help you enhance the functionality and appearance of your WordPress website. With shortcodes, you can easily add different types of content, such as images, videos, galleries, forms, and more, to your posts, pages, widgets, and other website areas. So go, give it a try!

Leave a Comment