Changeset 13683
- Timestamp:
- 03/12/2010 04:08:37 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r13650 r13683 2082 2082 2083 2083 // Return p= link for posts. 2084 if ( !empty($post_id) ) {2084 if ( !empty($post_id) && '' != get_option('permalink_structure') ) { 2085 2085 $post = get_post($post_id); 2086 2086 if ( isset($post->post_type) && 'post' == $post->post_type ) … … 2106 2106 return; 2107 2107 2108 echo '<link rel="shortlink" href="' . $shortlink . '" />';2108 echo "<link rel='shortlink' href='" . $shortlink . "' />\n"; 2109 2109 } 2110 2110 … … 2130 2130 } 2131 2131 2132 /** 2133 * Display the Short Link for a Post 2134 * 2135 * Must be called from inside "The Loop" 2136 * 2137 * Call like the_shortlink(__('Shortlinkage FTW')) 2138 * 2139 * @since 3.0.0 2140 * 2141 * @param string $text Optional The link text or HTML to be displayed. Defaults to 'This is the short link.' 2142 * @param string $title Optional The tooltip for the link. Must be sanitized. Defaults to the sanitized post title. 2143 * @param string $before Optional HTML to display before the link. 2144 * @param string $before Optional HTML to display after the link. 2145 */ 2146 function the_shortlink($text = '', $title = '', $before = '', $after = '') { 2147 global $post; 2148 2149 if ( empty($text) ) 2150 $text = __('This is the short link.'); 2151 2152 if ( empty($title) ) 2153 $title = the_title_attribute( array('echo' => FALSE) ); 2154 2155 $shortlink = wp_get_shortlink($post->ID); 2156 2157 if ( !empty($shortlink) ) 2158 echo "$before<a rel='shortlink' href='$shortlink' title='$title'>$text</a>$after"; 2159 } 2160 2132 2161 ?>
Note: See TracChangeset
for help on using the changeset viewer.