WordPress Header Page Links - wp_list_pages
You want to list your pages as fixed links, for example in the header of the theme, rather than simply use the sidebar lists, with widgets or otherwise. In WordPress, this is handled by the wp_list_pages() function.
First up, this function has a title_li (string) parameter which sets the text and style of the Page list’s heading. If passed a null or empty value, no heading is displayed, and the list will not be wrapped with ul tags. You’ll probably not want the “Pages:” displayed as well as the link list, so this code does the business:-
<div id="headerlinks">
<ul>
<?php wp_list_pages('sort_column=menu_order&title_li='); ?>
</ul>
</div>
At this point, we can turn to the CSS - you’ll also probably want the list items displaying inline rather than block, so this would be a simple starting point:-
#headerlinks ul{
list-style-type:none;
margin:0;
padding:0;
}
#headerlinks ul li.page_item{
display:inline;
margin:0;
padding:0 0 0 5px;
}
Equally, you could plug in some CSS code for any menu - make it DHTML at this point(?)
Bear in mind that 2 CSS selectors are available to differentiate a current (active) page from others.
li.page_item { … }
li.current_page_item { … }
Advanced - this displays all your pages with no exceptions, but the wp_list_pages() function has parameters for including or excluding pages, handling subpages and various display options - the details are here.











