Switch language

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




the_shortlink [ WordPress Function ]

the_shortlink ( $text = '', $title = '', $before = '', $after = '' )
Parameters:
  • (string) $text Optional The link text or HTML to be displayed. Defaults to 'This is the short link.'
  • (string) $title Optional The tooltip for the link. Must be sanitized. Defaults to the sanitized post title.
  • (string) $before Optional HTML to display before the link.
  • (string) $after Optional HTML to display after the link.
Defined at:



Display the Short Link for a Post

Must be called from inside "The Loop"

Call like the_shortlink(__('Shortlinkage FTW'))

Source


<?php
function the_shortlink$text ''$title ''$before ''$after '' ) {
    global 
$post;

    if ( empty( 
$text ) )
        
$text __('This is the short link.');

    if ( empty( 
$title ) )
        
$title the_title_attribute( array( 'echo' => false ) );

    
$shortlink wp_get_shortlink$post->ID );

    if ( !empty( 
$shortlink ) ) {
        
$link '<a rel="shortlink" href="' esc_url$shortlink ) . '" title="' $title '">' $text '</a>';
        
$link apply_filters'the_shortlink'$link$shortlink$text$title );
        echo 
$before$link$after;
    }
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



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