Skip to main content

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.

The post How to Use Shortcodes in your WordPress Sidebar Widgets appeared first on WPBeginner.

from: WPBeginner
via Editorial Staff

Source: How to Use Shortcodes in your WordPress Sidebar Widgets Via Business Advice.

Comments

Popular posts from this blog

How to Add Web Push Notification to Your WordPress Site

Do you want to add push notifications to your WordPress site? Push notifications allow you to send notifications to users even when they are not visiting your website. In this article, we will show you how to easily add web push notifications to your WordPress site. We will also talk about the best WordPress push notification plugins and how to send desktop & mobile push notifications from your WordPress site. What is Push Notification? Push notifications are clickable messages displayed on top of user’s desktop or notification area on their mobile device. They can be shown even when the user’s browser is not open. Aside from desktop, web push notifications also work on mobile devices. This allows you to reach your users across devices with latest updates and offers. Web push notifications have proven to be a very effective way to convert website visitors into customers and loyal followers. Why Add Web Push Notifications to Your WordPress Site? We have already discussed tha...

7 Ways to Grow Your SaaS Startup Faster

Every startup looks for ways to catapult a business to success. Here are some tips for accelerating growth for SaaS (software as a service) companies. 1. Start charging early SaaS startups are often hesitant about charging customers. They think that their product is not yet ready, that it’s necessary to get traction and focus on expanding their customer base rather than on growing revenue. Deep inside, however, they often don’t just have enough faith in their product and are not sure if someone will buy it at all. They prefer keeping hundreds or thousands of free users to attempting to win a few serious customers. Big numbers are comforting but the product remains an unverified idea. Building a product should imply increasing revenue. So don’t hesitate too much—put it to the test by charging and see if it works in the real conditions. This is one way to minimize your risk too. Instead of waiting to launch until you’ve invested huge amounts of time and money, launch early. If...

5 Things You Should Know about Purchasing a Company Vehicle

  Many businesses require a vehicle to do business. It transports both goods and people from point A to point B and allows you to keep business dealings in-house. However, choosing a good company vehicle can be somewhat complex. You shouldn’t take the decision lightly. Here are a few things you should know before you buy a vehicle for your business: Accidents can happen, placing liability on you. You might think that an accident won’t happen if you hire drivers with a good track record and write a rule-book with strict policies and procedures. These are good tactics for mitigating some of the risks associated with commercial car accidents, but they won’t protect you completely. More than two million car accidents happen each year. Many of them are commercial truck accidents, costing millions in damages. Since commercial drivers are on the road more than personal drivers, they’re significantly more likely to cause an accident. Understanding the liability that’s placed on yo...