All theme dev who follows the wp guidelines properly, now uses ability of default wp customizer to customize their themes, instead of making a different theme option section the admin panel.

But what I was unable to figure out is that how to use shortcode within that wp customizer.

For example:
In one of the theme I saw a section in the customizer called copyright text. Now I could manually put Copyright 2016, but what I wanted to do is to take advantage of wp shortcode. So I created a simple shortcode called year to auto fetch the current year.

add_shortcode('year', function() {
    return date( 'Y' );
});

But when I use [year] within wp customizer, it doesn’t recognize the shortcode. I know there is a way to enable shortcode for widget area, but I was thinking if there is something similar for the wp theme customizer are too.

Any help will be great…

3 s
3

wrap whatever you are outputting the shortcode in around do_shortcode()

Leave a Reply

Your email address will not be published. Required fields are marked *