WordPress Info at sieker.info

Documentation

Installation

  1. Download the current version from here
  2. unzip the archive. this will create a folder called wp-pagesnav
  3. Upload that folder to your wordpress plugins folder `wp-content/plugins/`
  4. Activate the plugin on the WordPress Admin plugin screen
  5. Add the following sample styles to your themes styles.css file
    /* Pages Nav */
    #pages_nav {
            margin:10px;
            padding-left:15px;
            padding-right:15px;
    }
    
    #pages_nav ul {
            background-color:#3F80B6;
            margin:0px;
            padding:0px;
            border: solid 1px white;
            font-size:1.25em;
            list-style: none;
    }
    
    #pages_nav ul.level2 {
            background-color:#5497CE;
    }
    
    #pages_nav ul.children {
            background-color:#6BADE1;
    }
    
    #pages_nav li {
            margin: 0px;
            padding-top:3px;
            padding-bottom:2px;
            padding-left: 5px;
            padding-right: 5px;
            border-left: solid 2px white;
            display:inline;
    }
    #pages_nav  a{
            color:white;
            font-weight: bold;
    }
    
    #pages_nav li.current {
            padding-top:0px;
            padding-bottom:0px;
            background-color:white;
            border:solid 1px #3F80B6;
    }
    #pages_nav li.current a{
            color:#3F80B6;
    }
    

    the file styles.css in the plugin folder also contains the sample css styles.

  6. Add the following code to your theme:
    <div id="pages_nav">
    <?php if(function_exists("wp_pages_nav")) {
          wp_pages_nav("show_all_parents=1&sort_column=menu_order");
        } ?>
    </div>
    

    the file template-source.php also contains the sample code.

  7. Change the parameters of the call to wp_pagesnav() in your theme to fit your needs. Have a look at the section parameters to find out how you can tune wp_pagesnav to fit your needs.
    Also tune the wp_pagesnav css style to match your theme.

Parameters

  • show_all_parents
    If show_all_parents is set then the navigation will get larger and larger
    the further down the page hierarchy you navigate.
    Default:0
    accepted values: 0 or 1
  • show_root
    If show_root is set then also the top most pages are displayed.
    Default: 1
    accepted values: 0 or 1
  • current
    If current is set to a value other than -1 wp_pages_nav uses that value as the currently viewed page ID even if the currently viewed page is a different one.
    Default: -1
    accepted values: page ID
  • home
    If specified a page with this value as the post slug will link to your site url (homepage).
    Default:’home’
    accepted values: page title
  • list_tag
    If set to 0 suppress the initial <ul> this lets you add static links to the beginning of the navigation.
    Default: 1
    accepted values: 0 or 1
  • depth
    How many levels of pages to drill down to. For example if set to 0 wp_pagesnav won’t display any pages at all.
    If set to 1 wp_pagesnav will only display the root pages.
    Default: -1
    accepted values: a number greater 0
  • show_parents
    if set to 0 don’t display the parents of the current page.
    Default: 1
    accepted values: 0 or 1
  • show_children
    if set to 0 don’t display the children of the current page.
    Default: 1
    accepted values: 0 or 1

Also all of the parameters of the get_pages function are supported. Which are:

  • child_of
    Only select pages which are a child of child_of. Default: 0
  • sort_column
    Database column by which to sort the pages. Default: post_title
  • sort_order
    Wether to sort ascending or descending. Default: ASC
  • exclude
    Pages to exclude Default: none
48 Comments »

Great plugin! Now is there a way so that the children will show up right underneath their parent, instead of at the end of the list of links?

IE:

- One
– Sub One
– Sub Two
- Two
– Sub One

Comment by Brian Agosta — 18 January 2007 at 20:30

I agree with Brian and an looking for the same vertical configuration.

Comment by John Calderon — 24 January 2007 at 22:10

Hi John, Brian,

OK, I’ve had a people wanting that feature, so I’ve put it on my todo list.

Not quite sure when I’ll get around to it though.

Regards
Adi

Comment by Adi — 25 January 2007 at 10:44

Great plugin !! Exactly what I was looking for.

I use it in my pages.php file :)

Comment by Scott — 28 January 2007 at 17:42

you beauty!

(btw, your current version still has a version number of 0.0.1 in the plugin)

Comment by xurizaemon — 15 February 2007 at 5:42

I was glad to see this plugin… :-) but after testing it appeared that it couldn’t work as a vertical menu. What a pity. :-(
I hope that we all will see this feature very soon :-)

Comment by Anna — 11 March 2007 at 22:27

In documentation it is said:
“home
If specified a page with this value as the post slug will link to your site url (homepage).
Default:’home’”

I don’t get it. Specified in where? I don’t know what to change in settings or somewhere else to define a page for ‘home’.

Comment by Serola — 16 March 2007 at 13:11

Hi Serola,

if you add something like this home=index to the wp\_pages\_nav call and then add a page index wp_pages_nav will set the link on that page to the blogs url.

adi

Comment by Adi — 16 March 2007 at 19:25

Thanks for great plugin!

However, I can make highlighting active menu items work. Why does the plugin generates code like this:

&lt;li class=' current' &gt;&lt;a
href='http://www.somesite.com/page-title/' title='Page Title'&gt;Page
Title&lt;/a&gt;&lt;/li&gt;

Comment by Fafek — 16 March 2007 at 21:39

I’m sorry! I meant code like this:

Page
Title

Comment by Fafek — 16 March 2007 at 21:41

Thank you Adi,
Now it works like a dream. I just didn’t understood that I have to create an empty page with the title ‘home’, ‘index’ or what ever I want to be displayed as a link for main page. This is an excellent plugin. Thank you very much :)

Comment by Serola — 17 March 2007 at 22:05

hi !

How do i stop long menu items splitting in two?
I would like the item to go to the begining of a new line.

Home something something2 something3 …. something9

When the navmenu line fills up, at some point you get some then thing9 on a new line.
How can i make sure no broken navmenu items display,
if it doesnt fit, i want a new line to start ?

thanks

Comment by Ram — 22 March 2007 at 13:41

If you assign a “front static” page, and use another page to hold your posts, but the page where all my posts actually appear never is highlighted with the current class.

Why is this?

Comment by AD — 23 March 2007 at 19:51

AD, I expected the nice kind of “brick wall” layout for the page navigation, but all I got was a bulleted list of page names/links. On a test blog I installed according to your instructions using the default theme (wp 2.02), put the style sample in the end of style.css and the function call part at the end of header.php
Did I miss something?
p.s. “your theme” under install step 6 is a little bit unclear, one wonders where. d.s.

Comment by Rille — 5 April 2007 at 11:16

Sorry, but is possible setting current page for post category?

Comment by giovanna — 18 April 2007 at 1:18

Is there a way to list custom fileds of a page near the page name in a menu…

Comment by Helder Luis — 21 April 2007 at 17:27

Great plugin, I just have one question: Is there any way to order the pages that you want listed? Instead of all the pages just being ordered either ASC or DESC, can you list what pages, and what order you want them in?

Thanks!

Comment by Aaron — 23 April 2007 at 6:36

Nice plugin (I’ve used it before!)

I’ve just tried enabling it on a WP2.2 site and am told: ‘Plugin could not be activated because it triggered a fatal error.’

Should it work on 2.2?

Cheers.

Comment by 3stripe — 24 June 2007 at 19:19

Hi Adi,

Your plug-in works wonders. We’re currently implementing and tweaking it on this site. I have a couple questions, though, and it would be great if you could get back to me:

1. How do I exclude certain pages from the navigation? Let’s say that pages with IDs 23 and 24 should not appear on the menu. I’m trying to use ‘exclude=23,24′ within the wp_pages_nav call in the header code, but no success.

2. If a user navigates from parent to child, how can I make sure that the parent page link stays “illuminated”, so the user knows which page and section of the website he is on? I think this concerns the stylesheet. Can you offer some advice?

Thanks,
- kevan

Comment by Kevan — 18 July 2007 at 21:52

Yah this really is a great plug-in. Two of the features mentioned above
1) Child Pages show up right under their parent
2) Ability to sortby ID rather than just ASC/DESC would be great.

Comment by Brian — 20 July 2007 at 4:36

Actually, I figured out how to sort…..now if I can just get the child pages to show under their parent. That would ROXOR!

Comment by Brian — 20 July 2007 at 5:04

Could I add my vote to child items showing under their parent. As it stands at the moment I think I might have to use a different plugin as I really need this functionality. It would be great if the code generated could look something like:

Home
Blog
Countries

England
Scotland
Wales

Contact

Comment by John — 3 August 2007 at 12:29

I have a front page set to static page “Home” and a
tab called “Blog” to show my posts. But the blog tab doesn’t highlight when it is the current item. How do I fix this?? Thanks so much!

Comment by Rebecca — 23 August 2007 at 13:20

Hi Adi,

thanks a lot! The plugin works great but I had the same problem as Rebecca. When I set the Articles page to be another one than home, then I can’t get it highlighted as “current”.

I guess it depends from the lack of page title as the Article page is NOT properly a page as any other one..

But still I can’t get out from this issue…

Hope you can help. And If you can’t thanks anyway for the great job.

Matteo

Comment by Matteo — 25 September 2007 at 17:52

Thanks so much for this. While you unfortunately did not manage to save me past days worth of headaches, you managed to save me any future headaches. Greetings from Denmark.

Comment by Joen — 4 October 2007 at 21:43

I am having the same problem at Rebecca and Matteo. It seems my nav highlights all the selected pages, but the page I use to post from doesn’t highlight when selected.

Link

Notice how PVTA NEWS AND EVENTS doesn’t highlight when its page is selected.

Comment by Joe Kromer — 2 November 2007 at 4:14

I have successfully used this on some themes but I cannot seem to get it to work on the dkret3 theme. Is there something specific in the style.css of the theme that stops the sub pages from being show in the nav bar .

Comment by Paul Black — 27 November 2007 at 17:59

[…] Plugins and information            Comment on Documentation by Rebecca I have a front page set to static page “Home” and a tab called “Blog” to show my posts. But the […]

Pingback by Comment on Documentation by Rebecca — 5 December 2007 at 23:17

I have figured out how to make child pages drop down to a second row beneath the parents. Just change

#pages_nav ul.level2 {
        background-color:#5497CE;
}

#pages_nav ul.children {
        background-color:#6BADE1;
}
to
#pages_nav ul.level1 {margin: 0; padding: 0; }

#pages_nav ul.level2 { clear: both; }

Comment by DewDrop — 21 December 2007 at 18:32

To also highlight the parent when viewing one of its children, add this:


#pages_nav ul.level1 li.currentparent a { 
	color: #0F4011; 
	background: #eeeeee;
	}

(or whatever colors you’re using)

Comment by DewDrop — 21 December 2007 at 18:51

Re: #6 - add following code to your theme. To what file in the theme?

Comment by Kim — 15 January 2008 at 20:52

[…] page nav :   […]

Pingback by Aide — 17 January 2008 at 12:11

How do i get it to show the parent and associared children from the current page? so the current page is child1 the output should look like…

parent1
child1ofParent1
child2ofParent1
or
when another page is selected
parent3
child1ofParent3
child2ofParent3
child3ofParent3

so only parent1 or parent3 from the root shows based on the currently selected page, not all root pages?

Comment by James Rodgers — 23 January 2008 at 20:36

Something’s fishy…

In the case when the “Main” page is selected as “static”, the thing doesn’t work properly.

On my site, the blog is in it’s own page “Blog” with URI being /blog/ .

But the “current” value doesn’t work for this page!

[Sorry, I wish i could keep the sample of the error running , but in a few minutes will change it, by deleting your plugin. It looked very promissing for a while!] :-((

Comment by Peter — 3 March 2008 at 9:13

Does the plugin work for WP 2.5? Greets!

Comment by pixelgirl — 15 April 2008 at 15:24

This is not working at all for me! Displays nothing. Even took out the if statement. On WP 2.5.1

here’s a link. in the view source there’s just an empty div.

Any ideas?

Comment by Chris Howard — 6 June 2008 at 6:13

I’d also like the option of child menus displaying directly underneath their parents. Without this option the plugin is really only useful for horizontal navs.

Comment by Dan — 9 June 2008 at 2:28

Wp-Menu (slighly different)

Hi Jorg,
if it would be easy for you and you’d like to,
have a look here and tell us what you think about this
wordpress.org/support/topic/181579
I guess I’m not the only WP_user who’d appreciate
your abilities.

thanks here, frank

Comment by Franky — 16 June 2008 at 20:34

I too am trying to show the parent of the current child page, the same as James Rodgers. He wrote:

How do i get it to show the parent and associared children from the current page? so the current page is child1 the output should look like…

parent1
child1ofParent1
child2ofParent1
or
when another page is selected
parent3
child1ofParent3
child2ofParent3
child3ofParent3

so only parent1 or parent3 from the root shows based on the currently selected page, not all root pages?

Has htere been any success in achieving this?
cheers for the great plugin.

Comment by fibaby — 16 June 2008 at 23:59

Hi fibaby,

WP-PagesNav doesn’t support what you want. Have a llo at wp_list_pages which is part of the standard WP install. That should do what you want.

adi

Comment by Adi — 17 June 2008 at 10:18

anyone know how to flip the list so that the children are on top and the parents are on bottom? I moved the code to output the parents after the code to output the children. Works great when you are on a parent page, but when you click the subpage, it flips back. Any ideas?

Comment by michael — 1 August 2008 at 0:31

i figured it out… just comment out the line that says…
$parents = array_reverse($parents);

Comment by michael — 1 August 2008 at 17:31

ok, new question… when clicking on a parent, how would one default to the first child page of that parent? So in effect if I click on Parent link 1, it would go to child 1 of parent link 1.

Comment by michael — 1 August 2008 at 22:19

Kevan:

To exclude a page use
wp_pages_nav("show_all_parents=1&sort_comVVU&FW"fW6VFS"".

Instead of the number ‘2′, used in that example, you’ve to fill in the page ID of the page you want to exclude. You can find that ID within the MySQL Database.
Unfortunatly the menu is not shown on the page you excludet.

Comment by Clemens Beier — 12 August 2008 at 23:37

‘wp_pages_nav(”show_all_parents=1&sort_column=menu_order&exclude=2″)’

Comment by Clemens Beier — 12 August 2008 at 23:38

Hi, great plugin, i maanaged to exclude some pages, but then when i’m inside one of those ‘excluded’ pages the menu won’t show anymore.
Is there a way to show it anyway?
Thanks,
Gio

Comment by Gio — 2 October 2008 at 19:20

[…] mit horizontalem Hover-Menü - pageMash - pageManagement - WP Pages Only - CMS-Like Admin Menu - WP-PagesNav - Fold page […]

Pingback by Brustpumpe » Linksammlung: Wordpress als CMS — 8 October 2008 at 10:41

It is a good article,thanks for your sharing.

Comment by woodman — 1 April 2009 at 15:27

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

(required)

(required)