...
Tutorials, Wordpress

How to Use Shortcodes in your WordPress Sidebar Widgets?

24 December 2018

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 Shortcodes in your WordPress Sidebar Widgets inside the text edit area.

Shortcode:

[display-post]

Method 2: Adding Shortcode in WordPress Using 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.

function codecanalfunction(){
//do your stuff here
}
add_shortcode('codecanal shortcode', 'codecanalfunction');

Shortcode:

[codecanal shortcode]
Output Here:

Leave a Comments