Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_page_link [ WordPress Function ]

get_page_link ( $id = false, $leavename = false, $sample = false )
Parameters:
  • (int) $id Optional. Post ID.
  • (bool) $leavename Optional, defaults to false. Whether to keep page name.
  • (bool) $sample Optional, defaults to false. Is it a sample permalink.
Returns:
  • (string)
Defined at:



Retrieve the permalink for current page or page ID.

Respects page_on_front. Use this one.

Source


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

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

    if ( 
'page' == get_option('show_on_front') && $id == get_option('page_on_front') )
        
$link home_url('/');
    else
        
$link _get_page_link$id $leavename$sample );

    return 
apply_filters('page_link'$link$id$sample);
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



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