How to use walker to replace core function
Posted
by bellesebastien
on Stack Overflow
See other posts from Stack Overflow
or by bellesebastien
Published on 2010-05-28T16:12:17Z
Indexed on
2010/05/28
17:12 UTC
Read the original article
Hit count: 605
Wordpress
|wordpress-theming
I want to modify the way pages are listed in the navigation, particularly the function el_start from wp-includes/classes.php.
I've first modified the classes.php directly and it worked fine butnow I want to revert classes.php and move the modification out of wordpress' internal files.
I wrote a walker class that I want to use but I don't know how to use it. I want to replace the current call wp_list_pages() to this:
$walker_pages = new Walker_Page_CustomTitle;
wp_list_pages(array('walker' => $walker_pages, 'title_li' => '', 'depth' => '1'));
I've tried using a filter like so:
function wp_list_pages_custom() {
$walker_pages = new Walker_Page_CustomTitle;
wp_list_pages(array('walker' => $walker_pages, 'title_li' => '', 'depth' => '1'));
}
add_filter('widget_area_primary_aside', 'wp_list_pages_custom');
But with this filter, the site won't load anymore.
The tutorial here says I should put this code in header.php but that just puts my page links in the tag.
I hope I'm making sense. Thanks.
© Stack Overflow or respective owner