This is one of the most used functions in WordPress because it displays a list of WordPress Pages as links, and affords the opportunity to have Home added automatically to the list of Pages displayed. This Tag is useful to customize the Sidebar or Header, but may be used in other Templates as well
<?php wp_page_menu( $args ); ?>
(string) Sorts the list of Pages in a alphabetic order by title of the pages.
‘post_title’ – Sort Pages alphabetically by title.
‘post_date’ – Sort by creation time.
(string) The div class the list is displayed in. Defaults to menu.
(string) Only list pages identified with the corresponding id’s, i.e.
wp_page_menu(‘include=2,14′) will list only pages with id’s 2 and 14
(string) Define a comma-separated list of Page IDs to be excluded from
the list (example: ‘exclude=3,7,31′).
(string) Define a comma-separated list of parent Page IDs to be excluded.
Use this parameter to exclude a parent and all of that parent’s child Pages.
(boolean) Toggles the display of the generated list of links or return
the list as an HTML text string to be used in PHP.
(boolean) Add “Home” as the first item in the list of “Pages”.
(string) Sets the text or html that precedes the link text inside < a > tag.
(string) Sets the text or html that follows the link text inside < a > tag.
(string) The Menu’s HTML, if the ‘echo’ parameter is set to false.
Display Home as a Page
The following example causes “Home” to be added to the beginning of the list of Pages displayed. In addition, the Pages wrapped in a div element, Page IDs 5, 9, and 23, are excluded from the list of Pages displayed, and the pages are listed in Page Order. The list is prefaced with the title, “Page Menu”:
<h2>Page Menu</h2> <?php wp_page_menu('show_home=1&exclude=5,9,23' .'&menu_class=page-navi&sort_column=menu_order'); ?>