Definition:
function get_page_uri($page) {}
Builds URI for a page.
Sub pages will be in the "directory" under the parent page post name.
Parameters
- mixed $page: Page object or page ID.
Return values
returns:Page URI.
Source code
function get_page_uri($page) {
if ( ! is_object($page) )
$page = get_page($page);
$uri = $page->post_name;
// A page cannot be it's own parent.
if ( $page->post_parent == $page->ID )
return $uri;
while ($page->post_parent != 0) {
$page = get_page($page->post_parent);
$uri = $page->post_name . "/" . $uri;
}
return $uri;
}
1548

February 12, 2011 


No comments yet... Be the first to leave a reply!