calling a widget from anywhere in a theme
So we can call any widget anywhere in a theme using the_widget. Bono has a page about the_widget here
We can call the default pages widget like this:
We can custom wrap it like this:
$args = array( 'before_widget' => '<div class="widget">', 'after_widget' => '</div></div>', 'before_title' => '<div class="widgetTittle">', 'after_title' => '</div><div class="widgetBody">' ); the_widget('WP_Widget_Pages', null, $args);
We can even tell it to custom sort it like so:
the_widget('WP_Widget_Pages', 'sortby=post_modified', $args);
But for the love of god, does anyone know how to get access to the stored widget options? I’m going out of my mind trying to figure it out.
- The topic ‘calling a widget from anywhere in a theme’ is closed to new replies.