Skip to content

Instantly share code, notes, and snippets.

@illucent
Created February 6, 2014 14:31
Show Gist options
  • Select an option

  • Save illucent/8845269 to your computer and use it in GitHub Desktop.

Select an option

Save illucent/8845269 to your computer and use it in GitHub Desktop.
list wp page eg. sitemap
<?php
$parent = "PARENT_PAGE_ID";
$args = array(
'depth' => 0,
'show_date' => '',
'date_format' => get_option('date_format'),
'child_of' => $parent,
'exclude' => '',
'include' => '',
'title_li' => __(''),
'echo' => 1,
'authors' => '',
'sort_column' => 'menu_order, post_title',
'link_before' => '',
'link_after' => '',
'walker' => '',
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args);
foreach ($pages as $page) {
echo "<a href=\"" . get_page_link($page->ID) . "\">" . $page->post_title . "</a><br/>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment