View Single Post
Old September 15th, 2011, 12:36 PM
DogWalkingGear DogWalkingGear is offline
Join Date: Aug 2011
Posts: 15
Default Can I use shortcodes in a text widget?

I would like to be able to put a product into the sidebar on some pages and I would like to use the product ID to minimise how much work is needed to change it. I have done this via a shortcode in a post or page but when I tried to use a the same shortcode in a text widget I can't get it to work - is this possible?

I followed the instructions and have this working properly if the shortcode is in a page or post, but copying the same shortcode into a text widget does not seem to work
In a post [DFR:Embedded 150 Pic Cube?p=491100198966992] displays as the image
In a widget [DFR:Embedded 150 Pic Cube?p=491100198966992] just shows as the text

I tried adding add_filter('widget_text', 'do_shortcode'); to my theme - no luck
for other plugins I have used the following to get the shortcode to work in a widget
if ( function_exists ('name-of-plugin-function-that-does-shortcode')) {
add_filter('widget_text', 'name-of-plugin-function-that-does-shortcode' );
I can't try this since I don't know the name of the function for datafeedr shortcuts.

The documentation ( says shortcodes are for pages or posts but it would be handy to be able to use this one in a text widget as well.

Can you let me know if what I am trying is possible or let me know the name of the datafeedr shortcode function and I'll try the second method in my theme.

Many thanks!