WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Child Page List in Sidebar Widgets (7 posts)

  1. michaelisc
    Member
    Posted 7 years ago #

    I'm using Ver. 2.1.2 with the Tiga-06 template. I've tried everything I can find to hide child pages in the sidebar "Pages" widget list. No go.

    When I go back to the default sidebar I can use the "depth=-1" attribute and it works just fine. But not with the widget. I've tried using the "exclude" attribute, I've tried the Navigo and Fold Page List plugins. No good.

    Any ideas?

  2. ZendDV
    Member
    Posted 7 years ago #

    Open the file widgets.php in the Sitebar Widgets plugin directory and locate

    function widget_pages($args) {
    	extract($args);
    	$options = get_option('widget_pages');
    	$title = empty($options['title']) ? __('Pages') : $options['title'];
    	echo $before_widget . $before_title . $title . $after_title . "<ul>\n";
    	wp_list_pages("title_li=");
    	echo "</ul>\n" . $after_widget;
    }

    then change wp_list_pages("title_li=&depth=1"); to

    function widget_pages($args) {
    	extract($args);
    	$options = get_option('widget_pages');
    	$title = empty($options['title']) ? __('Pages') : $options['title'];
    	echo $before_widget . $before_title . $title . $after_title . "<ul>\n";
    	wp_list_pages("title_li=&depth=1");
    	echo "</ul>\n" . $after_widget;
    }

    I tried it and it works for me, at least.

  3. michaelisc
    Member
    Posted 7 years ago #

    Yup,

    That fixed it. Don't know how many times I lloked right past this code.

  4. anabelle
    Member
    Posted 6 years ago #

    I've tried adding de depth=1 argument but it still shows child pages...

    is there anything else i have to check?

  5. anabelle
    Member
    Posted 6 years ago #

    Ive also modified de

    'echo "\n" . $after_widget;' to 'echo "some text\n" . $after_widget;'to check, but "some text wasn't written

  6. anabelle
    Member
    Posted 6 years ago #

    now i deleted the entire function widget_pages

    and it still displays all pages (including childs)

    What the hell?

  7. beltman_jr
    Member
    Posted 6 years ago #

    Hi Anabelle,
    I just ran into the same issue.
    I am using the TIGA theme and it work out that the theme uses its own version of widget_pages.

    In TIGA there is a tiga.php file in which the default function widget_pages is overwritten. Simply add the &depth=1 parameter there and it will work

Topic Closed

This topic has been closed to new replies.

About this Topic