WP-PagesNav has it’s own page now, please go to WP-PagesNav.
The first release of my first WordPress plugin. The splendid WP-PagesNav. WP-PagesNav is a plugin which can be used to display a navigation bar using the static pages in your blog. Since my writing skills aren’t the best and a picture says more than a thousand words..

You can get the plugin here.

March 15th, 2005 WordPress Plugin: WP-PagesNav WP-PagesNav is a plugin which can be used to display a navigation bar using the static pages in your blog. Y […]
Thanks for doing this! I’m looking over your code and the results, and I think I would like to modify it somewhat. I see that you’ve made your function spit out a list with custom css classes. What I’d like to do is modify the pages list (the result of wp_list_pages) to show or hide the appropriate children, but not fuss with additional classes.
In other words, I think that what I’d like is something that adds a parameter to the wp_list_pages that says list all parent levels going back up to root, and list children for current page, and siblings for current child. If I decide that I’d like to turn the result of wp_list_pages into an inline list that runs across the top of the page rather than on the sidebar, I’d like to do that using my own flavor of css on the current tags. (That’s theory as yet untested because I haven’t yet gotten there. I still have to get the parent/child thing working first)
I’ll think about how to style it some more. Maybe the thing to do is generate a list whose ID is unique, say, id=”pageslist” and then style css parameters for the children of that list? Anyway, I’ll think some more about that.
er, I see that you do some funky stuff with markup in your comment tags… It italicised a bunch of things, whereas I attempted to write down the WP function names with underscores. I’ll try it using the code tag:
wp_list_pagesBug report #1, small change to make.
Line #115, at very end of line. Add \n to end of string:
From:
</li>";To:
</li>\n";makes for cleaner, more understandable list code.
Sorry for not reporting this bug to repository, your link doesn’t go to YOUR page for the plugin, but to general page. I’m just telling you which changes I’m making as I make them.
Thanks a bunch for the plugin! I was attempting to write something like this myself the weekend, and then I stumbled across this. It’s simple and beautiful, and helps me in my efforts to achieve XHTML Strict.
Putting it to good use on http://radio.mcad.edu/.
Very nice plugin! I just downloaded and tested it. So what does it really do:
When using WordPress as a general contage management system (CMS) WP-PagesNav is a great “improvement” (addon) to the existing WordPress distribution. It allows for high usability for designers.
Thx
plug is great.. i had worked around.. and worked around.. this helps quite a bit.
just wondering if it is as simple as including a style callout, but i can’t seem to figure out how to mark/highlight (differntly than the child.. ui thing, to give a trail fo bread crumbs) the parent(s) of the current child?
worked it out.. added a bit in the middle .. ‘tween lines 111 and 112..
also.. to control it, put in a style in the style.css
and it works quite nicely.. i assumed it should always be “on” but one never knows; i leave any further implementation / expansion up to you now..
although…. i am thinking about how to exclude pages.. hmmmmm
made some more modifications.. needed a menu item/page to the home / index page to come up as current AND to have that page link to the index; added a number of lines.. seems to run smoothly.. send me an email and i will send you over the code (can’t seem to spot an email address anywhere)
Am I stupid, or is there no “usage” stated for this function. I would like to use it but can’t figure out the usage syntax. I’ve looked at the code, and it is barely documented. I see 3 args that can are parsed . . . but what purposes do they serve? C’mon . . .
Hi Chip,
there is a readme.txt in the zip file.
Which which explains the recognized parameters and also explain their usage.
I did assume familiarity with php when writing the readme.txt
since you will have to edit your theme file to use it.
adi
Nice Plugin. But is it possible to get such a Plugin für Post-Categories? I dont have much Categories inmy pages, but many posts… but I dont know a way to get to post-categories in a nice way…
The functions of your plugin for posts whould solve all my problems.
Best regards!
Hi Jens,
I’m not quite sure what you want.
But you could have a look at the query_posts function
http://codex.wordpress.org/Template_Tags/query_posts#Category_Parameters and at wp_list_cats http://codex.wordpress.org/Template_Tags/list_cats
a combination of both might do what you want.
adi
Hi
Brilliant plug-in. I am using it very effectively at http://www.swmug.co.uk.
Thank you so much.
Rich
I have the plugin working, but it does not display the list items in a proper tree form. Here’s what I’m getting:
Item_1
Item_2 (selected)
Item_3
–Item_2_1
–Item_2_2
–Item_2_3
Shouldn’t I be getting:
Item_1
Item_2 (selected)
–Item_2_1
–Item_2_2
–Item_2_3
Item_3
Shouldn’t the child items be placed directly below the parent item and not at the end of the parent list?
I was able to leave proper breadcrumbs (highlighting the parent link) by adding the following after line 111 (just below $css_class = ”;)
Enjoy it!
By the way, thank you Adsworth for a much needed plugin!
This is something i\’ll be needing shortly.
Thanks
Hi!
I wonder if anyone has successfully used this nav as follows:
0. Rootpage1 | 1. Rootpage2
0. Children1 | Children2 etc
and when You’re on page “Children2″, it’s parent, “0. Rootpage1″ is highlighted aswell as the currentpage? I don’t get this to work!
Hi,
I active the plugin. But where do i set the code?
< ?php
if(function_exists("wp_pages_nav")) {
wp_pages_nav("show_all_parents=1&show_root=0");
}
?>
I try in header.php replace this code < ?php wp_list_pages('title_li='); ?>
When i do this i see nothing no pages.
Michel
Jesse,
I modified your code a bit for the latest version… just a few small tweaks:
if( $page_id == $page_tree[$r[’current’]][’parent’]){
$css_class .= ‘currentparent’;
}
Hi Jesse,
I’ll add that my version for the next release.
Thanks
Adi
Hello Adi,
Great plugin, but I can’t seem to get the sort order to function.
I added the sort_column param to:
wp_pages_nav(”show_all_parents=1&show_root=0&sort_column=menu_order”);
but it doesn’t seem to work anyway.
Do you know why?
EDIT: well now the underscores dissapeared from my previous comment, but I guess you know what I mean anyway… I want to be able to sort the pages by giving them “page order” in the wordpress admin
Oh, I’m doing the change in template-source.php by the way…
(sorry for so many comments)
Hi Joel,
I use it like this:
wp\_list\_pages(’sort\_column=menu\_order&title\_li=’);
in sidebar.php and the sort order works fine for me.
I guess template-source.php is part of your wordpress theme, right?
Regards
Adi
How might I get it to show the path to the current page, without also showing the children of that page? At the moment, I’m using
wp_pages_nav(”show_all_parents=1&show_root=1&sort_column=menu_order”)
to always show the top-level pages and also to show the path to the current page, but it then also shows the child pages. Basically, I would like the row with the higlight to be the last row.
Does anyone have a .patch file (generated with diff -up, and applied with patch) for that parent-highlighting hack, mentioned above by Ken Westin and Jesse? I can’t get it to work, and it doesn’t seem to be in the released .zip yet.
Joel,
you do need to add:
wp\_pages\_nav(”show\all\parents=1&show\root=0&sort\column=menu\order”);
to one of your template files. The template-souce.php file in the plugin is an example of what to add to your own theme file. If you are using the default theme you could for example replace the call of wp\_list\_pages with your call of wp\_pages\_nav.
adi
Hi Murray,
to your first post:
ul of the childern gets it’s own css class. So you could try adding this to your themes style sheet:
ul .children { display: none;}
the contents will still be there just not displayed.
I’m just about to release a new version with the currentparent patch applied.
adi
Hello,
where do i set the code in header.php for pool theme
if(function_exists(”wp_pages_nav”)) {
wp_pages_nav(”show_all_parents=1&show_root=0″);
}
?>
Thanks for your help
Hi Dav,
in header.php there should be a call to:
wp\_list\_page(….)
I replaced that with:
wp\_pages\_nav(”sort\_column=menu\_order&show\_all\_parents=0&show\_root=1&list\_tag=”);
I hope that helps you out a little.
adi
[…] The new menu uses the WP-PagesNav plugin by Adi Sieker which seems to work very well now that I have figured out how to use it. I had to make a minor change to the plug-in code as it didn’t quite work as expected - the plug-in has an option to suppress the leading ul tag on the first level so that you can add links, such as a link to home, but it also suppressed the closing ul tag for the first level as well, meaning that the code was not valid. Still, it was only a small edit and it really is a good plug-in. Thanks to Adi. I believe the plugin will output the whole menu to as many levels as you want although I have only tested it to 4 levels. With this many sub-pages you could quite easily add thousands of pages if you really wanted to. I hope that this will be more than enough for anybody! The neat thing is that the whole thing works dynamically so the sub-page menu only appears when sub-pages are available and outputs to a single div with each page levels output to an unordered list. As far as horizontal menus are concerned it is far better than the WordPress default. The only thing that remains is to style the menu and get it looking something like the original. Hopefully this will be easy so bear with me for a couple of days and I hopefully will be able to set up a demo site. […]
hi,
nice plugin. this question came already up but is still unanswered.
—
“I wonder if anyone has successfully used this nav as follows:
Rootpage1 | 1. Rootpage2
Children1 | Children2 etc
and when You’re on page “Children2″, it’s parent, “0. Rootpage1″ is highlighted aswell as the currentpage? …”
thanks
dex
[…] The new horizontal menu is controlled by the WP-PagesNav plug-in by Adi Sieker that I have modified and inserted into the theme functions file. I’ve coded the plug-in into the theme because the menu just won’t work without it and it seemed to be an easier option for the end user than having to download and install the plug-in separately. […]
Hi all,
I am having the same problem in the Comment by Romme — 14 September 2005.
I have:
Item 1
Item 2
Item 3
Item 2_1
Item 2_2
Item 2_3
Shouldn’t it be displaying:
Item 1
Item 2
Item 2_1
Item 2_2
Item 2_3
Item 3
I am not sure why and how to fix this. Can someone help me please?
Thanks.
Hi Sean,
to get a tree like display of your pages you can use the standard wp_pages_list() function, which is shipped with WordPress.
wp\_pages\_nav can’t display the pages in a tree like manner.
adi
Hi dex,
this should be possible, but it seems that there is a little bug in the plugin.
I’ll have a look at, as soon as possible.
adi
“I’m just about to release a new version with the currentparent patch applied.
adi”
Any update on the parent patch? I have tried the above patches by Ken & Jesse but for some reason it highlights both parents.
- G
I am having trouble getting this to validate as xhtml 1.0 strict. The script seems to leave out a UL tag and an end UL tag. Has anyone else had this problem?
Hi molly,
good god 2 weeks, I am mostly lacking when answering comments.
You need to either remove the parameter list_tag=
or add the opening and closing ul tags yourself.
Regards
Adi
Hi,
I would like to show only the parent but none of the children.
I’m thinking of using the wordpress as CMS so there will be many pages that i don’t want to show in main navigation.
Is there an easy way to accomplish this? (if i use exclude it would be a really long list…)
Hi John,
you can try passing the paramter ‘depth=1′ to wp_pages_nav. Also have a look at wp_list_pages which is part of wordpress.
adi
[…] Great pages plugin from adsworth.info that helps with page navigation in WordPress. Andreas Viklund is using it in WP Andreas 09 but Litquake wanted the top menu to have different hover over qualities. I knew I could get the “current” state to be a certain class and could easily do it by manually putting in a menu, but then it would lose Andreas’s fantastically automated pages and sub-navigation. […]
Hi,
Thanks for this plugin. I will ask the same question as two others have asked before —> where do you insert this code:
There is no indication as to whether or not this goes in to:
• header.php
or
• index.php
or
• [where else can it go?].php
Please would someone let those of us who are less than familiar with where this code can go or should go, know where we can insert the code.
Many thanks in advance.
Oops - I mean this code…
”
“
Hrmm … once again!
.’s inserted to allow for the code to be displayed.
div id=”pages_nav”
?php
if(function_exists(”wp_pages_nav”)) {
wp_pages_nav(”show_all_parents=1&show_root=0″);
}
?
/div
If this does not display, then I give up!
Wow amazing plugin. Lifesave
A question - how can I modify it so that when viewing child pages, “current” is also applied to the parent page? (In fact, I’m hiding child pages alltogether, as these are being outputted into another div)
And one more - how can I force this plugin to show on posts as well as pages? When browsing my News category, it doesn’t seem to output anything
Many thanks for your time.
Hi this is great hopefully somebody can help me.
I want to call the function twice on a page.
Once at the top to output only all the top level.
Once half way down to output all the children of the current selected top level.
Can this be achieved?
I tried your plugin. I must however say that it given unwanted output. The main problem is, that your code differs so much from the code without your plugin, so that the whole menu css stuff fails.
I can send you examples if necessary
Furthermore, the subitems are placed at the end of the list no matter where they should actualy appear.
If I can help to improve this behaviour tell me what information is neccessary for you.
Matthias Pospiech
[…] WP-PagesNav […]
[…] You can also try the WP-pagesnav WordPress Plugin (http://wp.sieker.info/wp-pagesnav) which creates a dynamic menu utilizing the normal Page structure. This plugin includes dynamic highlighting and menus of multiple levels with options. [edit] […]
thanks for the plugin. work of genius. one little bit of life a bit easier !! :O)
Hi thanks a lot for this great plugin,
I love it,
but is there any way to exclude pages?
regards
Monika
Cool blog…absolute pleasure to read your material.
Hi Adi, nice plugin.
I’ve been playing with it but something confuses me, the show_root parameter doesn’t seem to do anything. Setting it to 1 or 0 makes no difference, would you kindly look into this matter?
I’ve tried looking through your php source code, and I’m very confuse at how show_root would contribute to anything. If it does, I appologise for over looking it. Please kindly explain. Thank you.
Seige
Love the Plug-in as well. I did have a question about copy rights. Would we need to edit the content or is it just as is? If so how is it workable?
Thanks,
Suzie
www.performers-world.com
suzie@performers-world.com
Hi Suzie,
you don’t need to edit the plugin. You need to edit your WordPress theme to add the plugin to the theme.
And you need to add the css information of the plugin to the css file of your theme and modify it.
I hope this helps you along a little.
adi
My english is not so good. I hope you will understand me. I have a big problem: How can I show only the root - not the children? In the readme.txt says:
“The following parameters are recognized:
- show_all_parents […]
- show_root […] then also the top most pages are displayed.”
Where do I have to put - show_root - so that only the parents get activated?
I hope somebody knows what I’m talking about.
Thanks
Conny
I was just wondering if this can be used for category aswel. I’m kind of new to wp and recently installed a new theme.
Regards,
Rick
Hi Rick,
no wp_pages_nay can’t be used for categories,
although that a nice idea.
I’ll kep it in mind.
adi
Hi Conny,
in the current release it’s not possible to only display the root pages only.
I’m going to relese a new version with in a couple of weeks that supports only displaying the root pages.
adi
[…] Par un concours de circonstance, j’ai fini par retourner chez l’auteur du thème WP-Andreas09 1.9. Et là, heureuse surprise, non seulement la dernière version offre de nouvelle couleur de bandeau d’en-tête, mais la gestion par sous-menu a été incorporée en adaptant un plug-in —que je ne connaissais pas— permettant la gestion des menus et sous-menus. Si vous êtes plus intéressés par le plug-in que par le thème, il s’agit de WP-PagesNav de/par Adi Sieker. Très joli et efficace travail. […]