de

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




_get_page_link [ WordPress Function ]

_get_page_link ( $id = false, $leavename = false, $sample = false )
Zugriff:
  • private
Parameter:
  • (int) $id Optional. Post ID.
  • (bool) $leavename Optional. Leave name.
  • (bool) $sample Optional. Sample permalink.
Gibt zurück:
  • (string
Definiert in:



Retrieve the page permalink.

Ignores page_on_front. Internal use only.

Source


<?php
function _get_page_link$id false$leavename false$sample false ) {
    global 
$post$wp_rewrite;

    if ( !
$id )
        
$id = (int) $post->ID;
    else
        
$post = &get_post($id);

    
$draft_or_pending in_array$post->post_status, array( 'draft''pending''auto-draft' ) );

    
$link $wp_rewrite->get_page_permastruct();

    if ( !empty(
$link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) {
        if ( ! 
$leavename ) {
            
$link str_replace('%pagename%'get_page_uri($id), $link);
        }

        
$link home_url($link);
        
$link user_trailingslashit($link'page');
    } else {
        
$link home_url("?page_id=$id");
    }

    return 
apply_filters'_get_page_link'$link$id );
}
?>

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