Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using the Newsletter plugin (http://wordpress.org/extend/plugins/newsletter/) to compose e-mail newsletters. Using the "auto-compose" feature to pull website data via the theme included with the plugin, which I have begun to customise.

It's pulling posts just fine, which is a good start - but I would also like to pull some data that a custom widget on our site is displaying. I'm fairly new to Wordpress and the custom widget in question was not developed by me. Can I include a specific widget via my theme template?

Thanks

share|improve this question
    
I've tried using this code, but it's not pulling anything. <?php the_widget($widget_name); ?> –  Bill May 17 '11 at 14:27
add comment

1 Answer 1

up vote 0 down vote accepted

You may already know this, but you need to specify the widget's class name as the $widget_name variable in the template tag. For example,

Depending on the widget, you may also need to add parameters to the_widget() to get it to display properly — see notes on thewidget() $instance and $args in the codex. http://codex.wordpress.org/Function_Reference/the_widget

Alternatively, you can use a plugin like Widgets on Pages, which will let you include a widget anywhere using by using a shortcode like this: [widgets_on_pages id=WidgetName] http://wordpress.org/extend/plugins/widgets-on-pages/

share|improve this answer
    
Thanks, very helpful. –  Bill May 19 '11 at 10:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.