Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mat Lipe

    (@mat-lipe)

    Hi sabrinal,

    Yes there are to alter the output. Please describe what you are trying to do? For instance do you want the parent page to output as a title like
    <h4 class="widgettitle">Title</h4>

    Or are you trying to style your top level page like titles?

    I am happy to help if you give me more detail on what you are trying to do. Links to demonstrations may help as well.

    Cheers

    Thread Starter sabrinal

    (@sabrinal)

    Mat,Mat,
    I’m looking for a way to make the Widget title to be the parent page.
    Example for the title instead of manually entering the title in the widget tools that would be the same on every page I would like it to dynamically change so the parent page of the page you are on is in the title section.

    I’m looking for a why to make the Widget title to be the parent page.
    example for the title instead of

    Plugin Author Mat Lipe

    (@mat-lipe)

    Hi sabrinal,

    Here is how you can accomplish first

    First Update to version 4.2.0 which will be available shortly.

    Then add the following filter to your theme’s functions.php file.

    add_filter('advanced_sidebar_menu_widget_title', 'asm_parent_as_title',99, 4 );
    function asm_parent_as_title( $title, $args, $instance, $object){
        return sprintf('<a href="%s">%s</a>', get_page_link($object->top_id), get_the_title($object->top_id) );
    }

    Be sure to enter a title in your widget so it has something to filter.
    That’s should do the trick.

    If you don’t want the title to link anywhere you can change the filter to this.

    add_filter('advanced_sidebar_menu_widget_title', 'asm_parent_as_title',99, 4 );
    function asm_parent_as_title( $title, $args, $instance, $object){
        return sprintf('%s', get_the_title($object->top_id) );
    }

    Hope this helps!

    Cheers!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding Parents as Title’ is closed to new replies.