WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Tutorials» How to Use Shortcodes in your WordPress Sidebar Widgets

How to Use Shortcodes in your WordPress Sidebar Widgets

Last updated on March 1st, 2018 by Editorial Staff
480 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Use Shortcodes in your WordPress Sidebar Widgets

Do you want to learn how to use shortcodes in your WordPress sidebar widgets? Shortcodes allow you to do add additional features in your WordPress post content and other areas of your website. In this article, we will show you how to use shortcodes in your WordPress sidebar widgets.

How to use shortcodes in WordPress sidebar widgets

What Are Shortcodes?

Shortcodes allow you to add dynamic items like contact form, tables, and others inside your WordPress content area.

You can also use shortcodes in your widgets to add these dynamic items in your sidebars and other widget-ready area.

Let’s take a look at how to easily add and use shortcodes in your WordPress sidebar widgets.

Method 1: Adding Shortcode in WordPress Sidebar Using Text Widget

First thing you need to do is drag & drop a Text widget to your WordPress sidebar on the Appearance » Widgets screen in your dashboard. After adding the widget, you can simply add your shortcode inside the text edit area of the widget.

Adding shortcode in Text widget

Don’t forget to click on the ‘Save’ button to store your widget settings.

You can now visit your website and see the shortcode in action.

Shortcode displayed in sidebar widget

Method 2: Adding Shortcode in WordPress Using Custom HTML Widget

Sometimes you may want to add custom HTML code around your shortcode which may not work so well in the plain text widget. In that case, you will need to add your shortcode using the ‘Custom HTML’ widget.

By default, shortcodes are not allowed to be executed in a custom HTML widget. To change this, you will need to add the following code to your theme’s functions.php file or a site-specific plugin.

add_filter( 'widget_text', 'do_shortcode' );

After that, you can simply add a ‘Custom HTML’ widget to your sidebar and add your shortcode inside it.

Adding shortcode inside Custom HTML widget in WordPress

Don’t forget to click on the save button to store your widget settings.

You can now visit your website to see your shortcode in action.

Shortcode added by Custom HTML widget

We hope this article helped you learn how to easily add shortcode to your WordPress sidebar widgets. You may also want to see these essential tips for using shortcodes in WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

480 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • Checklist

    Checklist: 15 Things You MUST DO Before Changing WordPress Themes

  • How to Properly Move Your Blog from WordPress.com to WordPress.org

  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

34 Comments

Leave a Reply
  1. Arkanum says:
    Sep 16, 2020 at 1:37 pm

    Thanks! For me it’s work :D

    Reply
    • WPBeginner Support says:
      Sep 16, 2020 at 3:02 pm

      Glad our guide helped :)

      Reply
  2. Zdenko Zec says:
    Sep 18, 2019 at 10:18 pm

    Hi there. I have tried it on my website developed localhost but it is not working. I have tried both with the text widget and by adding the filter to the functions.php and using the Custome HTML. Can you please share your thoughts about that? Cheers

    Reply
    • WPBeginner Support says:
      Sep 19, 2019 at 10:34 am

      You may want to ensure the shortcode you’re using is a working shortcode.

      Reply
  3. Thanks a lot!! says:
    Aug 28, 2019 at 4:21 am

    Great post! thank you very much

    Reply
    • WPBeginner Support says:
      Aug 28, 2019 at 9:29 am

      You’re welcome :)

      Reply
  4. Muhammad Zeeshan says:
    Jun 27, 2019 at 3:45 am

    Hi
    Good morning
    Actually i want to show only text of the post on a specific page,how can i do this?

    Reply
    • WPBeginner Support says:
      Jun 27, 2019 at 10:59 am

      For what it sounds like you’re wanting, you may want to take a look at:

      https://www.wpbeginner.com/plugins/how-to-insert-wordpress-page-content-to-another-page-or-post/

      Reply
  5. Rahul says:
    Feb 17, 2019 at 2:16 am

    Last night i have install an Plugin for shortcode. But i could not use it. But now i’m success

    Reply
    • WPBeginner Support says:
      Feb 18, 2019 at 1:59 pm

      Glad our article could help :)

      Reply
  6. Ahmer says:
    Mar 1, 2018 at 10:58 pm

    This is very good and informative post about how to use shortcodes.

    I was looking for such article.

    Shortcodes really make difference in blogs and many people don’t know how to use them properly.

    Reply
  7. MikeL says:
    Oct 16, 2017 at 12:22 pm

    The custom code option only works in the widget text CONTENT area, but not the TITLE area.

    Reply
  8. nicole says:
    Sep 23, 2017 at 5:08 pm

    where do you go to actually create the shortcodes?? Im looking for where to find the settings shown in this screenshot:

    Reply
  9. Neville says:
    Jul 2, 2017 at 4:41 am

    Hi there,

    I have experience in website development, but am new to WooCommerce. I am building a website for a client, based on the Avada WP theme (5.6.1). This is under development:

    You will see that there is a carousel on the Home page, but I have been looking without success for a plugin to replace this which will allow me to display variable products in gallery/grid style. Needs to work with Woocommerce product variations, e.g. price, category, brief description. Add to Cart also would be ideal.

    I am wondering if shortcodes could be used to create this?

    If so, how could they be added to replace the carousel?

    Thanks.

    Neville

    Reply
  10. Brendan says:
    Jan 18, 2017 at 2:59 pm

    Hi,

    I tried using the shortcode widget as you suggested but I am still unable to align the widgets at the footer side by side rather than on top of each other.

    Are you able to help please?

    Thank you!

    Brendan

    Reply
  11. lukman says:
    Oct 26, 2016 at 1:05 pm

    It.is.not.working

    Reply
  12. Mathiew Burkett says:
    Sep 15, 2016 at 3:47 pm

    Hello

    I have created the Site Specific Plugin and activated the plugin.

    I am trying to get a shortcode to work in a different area where a shortcode will not currently work with my Theme.

    I am using the Socrates 3.08 version theme.

    Here is a link to a screenshot that I created that shows the two places that I have circled with a red circle where I need a shortcode to work and I right clicked on the area where I need to add the plugin and inspected it to find the code in the area of my theme where I am trying to get a shortcode to work at and added the screenshot of the code also.

    Would someone tell me if there is a function that I could add to the site specific plugin that will get a shortcode to work in the two areas that I have circled.

    Reply
  13. Gurpreet Singh Saini says:
    Aug 18, 2016 at 1:36 pm

    Thanks its working.

    Reply
  14. Bilal says:
    Jul 25, 2016 at 3:59 am

    yes, its working.

    Reply
  15. A WP Life says:
    Jun 23, 2016 at 7:52 am

    Hi There,

    User reported after new WordPress update 4.5.3.

    Shortcode not working in text widget..

    Our plugin is

    Need help, thanks in advance.

    A WP Life

    Reply
    • WPBeginner Support says:
      Jun 23, 2016 at 8:48 pm

      Please report the conflict to plugin author.

      Reply
  16. Vinicius says:
    May 28, 2016 at 10:43 am

    Thanks!

    Reply
  17. Monuruzzaman Milon says:
    Jan 14, 2016 at 2:23 pm

    Really Awesome I love your all blog post. Because I’m learning about wordpress theme development .Really it’s help for me about add_filter hook.

    Thanks,

    Reply
  18. Alfredo says:
    Apr 24, 2015 at 7:50 am

    Thank you so much.

    Reply
  19. Arra Referees says:
    Mar 6, 2015 at 9:38 am

    Thank You for this. Life Saver. Was using a plugin (GCAL) with a special sidebar widget but wouldn’t allow me to add a link to the calendar beneath it without delving into code. Simply adding this and using the short code really did the business. Many Thanks. Working in 4.1.1

    Reply
  20. Manuel Meurer says:
    Oct 15, 2014 at 6:17 am

    Awesome tip, still works great in WordPress 4.0!

    Reply
  21. cob-web says:
    Jun 27, 2014 at 5:47 am

    This saved my day – thanks! :)

    Reply
  22. slim shady says:
    Apr 17, 2014 at 5:20 am

    will it interpret [ ]everything as a shortcode?

    Reply
    • WPBeginner Support says:
      Apr 17, 2014 at 12:13 pm

      No only if a shortcode is registered. For example if you dont have a shortcode [apples] then it will display as it is.

      Reply
    • firoz says:
      Sep 30, 2016 at 12:27 am

      I want to shortcode in the sidebar

      Reply
  23. queenofthehivemomof5 says:
    Sep 6, 2011 at 1:03 pm

    I tried putting it at the bottom of the fuctions PHP template within the php tags and am still getting the RAW code wrapped around my shortcode. The shortcode is displaying it just shows [raw] [/raw] on either side of it.

    Any other suggestions? Thanks in advance!

    Reply
  24. wpbeginner says:
    Sep 6, 2011 at 8:11 am

    @queenofthehivemomof5 You need to paste it in between the php tags and make sure it is not part of any other funciton… so it is best to place it at the bottom.

    Reply
  25. queenofthehivemomof5 says:
    Sep 5, 2011 at 10:24 pm

    Is there a certain part of the fuctions.php file I should paste it into? It does not appear to be working for me. I get my shortcode output but it is surrounded by “Raw”

    [raw][/raw]TAB 1TAB 2TAB 3[raw][/raw]Tab content 1[raw] [raw] [raw][/raw] (something like that)

    Reply
  26. edward.caissie says:
    Sep 2, 2011 at 2:08 pm

    This line of code can be added to a plugin that has a shortcode and it will do the same thing, too … although adding the line of code to the functions.php file of a Child-Theme would be a more future-proof method.

    Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
All in One SEO logo
All in One SEO
Improve website SEO rankings with AIOSEO plugin. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
LiveChat logo
LiveChat Inc Coupon
Get a 30 day free trial and 30% OFF LiveChat, one of the best live chat service providers for WordPress users.
ConvertKit Coupon Code
ConvertKit Coupon
Get a 14-day no risk FREE trial with this powerful email marketing software.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.