View Single Post
  #3  
Old September 16th, 2011, 04:12 AM
DogWalkingGear DogWalkingGear is offline
 
Join Date: Aug 2011
Posts: 15
Default

Many thanks Eric,

I did have success by following a longer winded method and have included it here in case it is of use to anyone else. Basically I created my own shortcode and wrapped the datafeedr_tag() function.
By then using add_filter('widget_text', 'do_shortcode'); I have the shortcode functionality in my text widget.
I pass in the view name and the product number as variables.

/* Create our own shortcode to wrap a shop shortcode */
/* New shortcode is of the form [DWG_DFR view="Embedded 150 Pic Cube" productnum="491100198966992"]*/
function show_DFR_in_widget( $atts, $content = null ) {
/* Datafeedr does not yet support shortcodes in a text widget, wrap the datafeedr shortcode and display this one */
extract( shortcode_atts( array (
'view' => 'Sale Items',
'productnum' => '123456'
), $atts ) );
if ( function_exists ('datafeedr_tag') )
$DFR_result=datafeedr_tag($view.'?p='.$productnum) ;
else
$DFR_result='Datafeedr not configured';

return $DFR_result;
}
add_shortcode( 'DWG_DFR', 'show_DFR_in_widget' );

/*Add the filter to allow shortcodes to work in widget text areas */
add_filter('widget_text', 'do_shortcode');

Cheers,

Brian