I don’t want child pages to appear in my sidebar. I’ve triend various permutations with the depth argumument, but nothing I do seems to make any difference.
I edited sidebar.php and modified the wplist_pages line as follows:
<?php wp_list_pages(‘depth=1&title_li=<h2>’ . __(‘Pages’) . ‘</h2>’); ?>
The child pages are still listed in the sidebar. What am I doing wrong?
That code looks good for the depth, so maybe you are using Widgets?
Ah, ok, yes I guess I am. Any hints on what I need to do in that case?
Since you are using Widgets then the widget display is likely taking precedence over our sidebar displays. Either put your code outside the widget test in your sidebar.php or better yet, consider downloading and installing Otto’s execphp widget. Then put your wp_list_pages code in that widget.
Please remember to support our plugin authors by clicking on the Donate button there.
&A’s helped me greatly even though I am not using the widgets for these pages.
I was wanting to use the “Parent Child” to organize my wifes recipes on her blog. Following the instructions I created a templete page succesuffly.
wp_list_pagesactually gave me more than I wanted, I just need to go one level deep. The instructions referred to changing the depth and I was trying to figure out how to use the “depth” in the argument
<?php wp_list_pages('arguments'); ?>
Your example above enabled me to get my pages to work how I wanted.
<ul><?php wp_list_pages('depth=1&title_li=&child_of='.$post->ID.''); ?></ul>
It is now working just how I wanted. Thank you
EDIT: I wish I could read! The previous poster had the exact problem and solution. Oh well.
Using Otto’s widget also worked for me, but I wasn’t done. My widgets below the Otto block were all displaying as list items justified all strangely.
In order to fix it, I had to wrap the wp_list_pages code with un-numbered lists:
<?php echo '<ul>'; wp_list_pages('depth=1&title_li= '); echo '</ul>'; ?>
I hope this helps someone else out there who’s had a similar problem.
- The topic ‘wp_list_pages depth’ is closed to new replies.