Installation
- Download the current version from here
- unzip the archive. this will create a folder called wp-pagesnav
- Upload that folder to your wordpress plugins folder `wp-content/plugins/`
- Activate the plugin on the WordPress Admin plugin screen
- 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.
- 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.
- 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
