• Resolved Luis Martins

    (@lmartins)


    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://www.ads-software.com/plugins/be-subpages-widget/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    How are you adding the widget to your page?

    You should use the_widget() function (documentation) 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

    (@lmartins)

    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.