Title: Programatically adding be-subpages-widget
Last modified: August 22, 2016

---

# Programatically adding be-subpages-widget

 *  Resolved [Luis Martins](https://wordpress.org/support/users/lmartins/)
 * (@lmartins)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/programatically-adding-be-subpages-widget/)
 * Hey Bill,
 * I was wondering if you help me out with what I imagine is a simple task although
   im miserably failing at it.
    I need to add your widget programatically to my 
   page. I’ve already have displaying on the page but I can’t figure out how to 
   setup a few defaults, as defined usually on the widget configuration when added
   via Dashboard. More specifically, I was looking into displaying the parent page
   name as the widget title, one of the options available in the widget configuration.
 * I looked into the `be_subpages_widget_title` filter but couldn’t make it do any
   difference in the rendered page.
 *     ```
       function mw_widget_title( $title )
       {
           $title = "test";
           return $title;
       }
       add_filter( 'be_subpages_widget_title', 'mw_widget_title' );
       ```
   
 * Thanks.
 * [https://wordpress.org/plugins/be-subpages-widget/](https://wordpress.org/plugins/be-subpages-widget/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Bill Erickson](https://wordpress.org/support/users/billerickson/)
 * (@billerickson)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/programatically-adding-be-subpages-widget/#post-5735573)
 * How are you adding the widget to your page?
 * You should use the_widget() function ([documentation](http://codex.wordpress.org/Function_Reference/the_widget))
   which lets you pass the widget’s $instance settings and the sidebar’s $args. 
   So put all the relevant settings you would normally modify in Appearance > Widgets
   in $instance.
 *     ```
       $instance = array();
       $args = array();
       the_widget( 'BE_Subpages_Widget', $instance, $args );
       ```
   
 *  Thread Starter [Luis Martins](https://wordpress.org/support/users/lmartins/)
 * (@lmartins)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/programatically-adding-be-subpages-widget/#post-5735612)
 * Hey Bill,
 * Thank you so much for the tips.
    I ended up building the menu manually, but i’ll
   keep this for reference.
 * Cheers.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Programatically adding be-subpages-widget’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/be-subpages-widget_f3f3f3.svg)
 * [BE Subpages Widget](https://wordpress.org/plugins/be-subpages-widget/)
 * [Support Threads](https://wordpress.org/support/plugin/be-subpages-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/be-subpages-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/be-subpages-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/be-subpages-widget/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Luis Martins](https://wordpress.org/support/users/lmartins/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/programatically-adding-be-subpages-widget/#post-5735612)
 * Status: resolved