de

wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren




get_page_uri [ WordPress Function ]

get_page_uri ( $page )
Parameter:
  • (mixed) $page Page object or page ID.
Gibt zurück:
  • (string) Page URI.
Definiert in:



Builds URI for a page.

Sub pages will be in the "directory" under the parent page post name.

Source


<?php
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;
}
?>

Beispiele [ wp-snippets.com ]

Top Google Suchergebnisse

Mehr ...

Nutzerduskussionen [ wordpress.org ]

0 Nutzerkommentare

Noch keine. Sei der Erste!

Neu hinzufügen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics