Changeset 35001 for trunk/src/wp-includes/link-template.php
- Timestamp:
- 10/10/2015 05:40:14 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/link-template.php
r34988 r35001 11 11 * 12 12 * @since 1.2.0 13 * @since 4.4.0 Added `$id` parameter.14 * 15 * @param int|WP_Post $ id Optional. Post ID or post object. Default current post.16 */ 17 function the_permalink( $ id= 0 ) {13 * @since 4.4.0 Added the `$post` parameter. 14 * 15 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. 16 */ 17 function the_permalink( $post = 0 ) { 18 18 /** 19 19 * Filter the display of the permalink for the current post. … … 23 23 * @param string $permalink The permalink for the current post. 24 24 */ 25 echo esc_url( apply_filters( 'the_permalink', get_permalink( $ id) ) );25 echo esc_url( apply_filters( 'the_permalink', get_permalink( $post ) ) ); 26 26 } 27 27 … … 95 95 * @see get_permalink() 96 96 * 97 * @param int|WP_Post $id Optional. Post ID or post object. Default current post. 97 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. 98 * @param bool $leavename Optional. Whether to keep post name or page name. Default false. 99 * 100 * @return string|false The permalink URL or false if post does not exist. 101 */ 102 function get_the_permalink( $post = 0, $leavename = false ) { 103 return get_permalink( $post, $leavename ); 104 } 105 106 /** 107 * Retrieve full permalink for current post or post ID. 108 * 109 * @since 1.0.0 110 * 111 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. 98 112 * @param bool $leavename Optional. Whether to keep post name or page name. Default false. 99 113 * @return string|false The permalink URL or false if post does not exist. 100 114 */ 101 function get_the_permalink( $id = 0, $leavename = false ) { 102 return get_permalink( $id, $leavename ); 103 } 104 105 /** 106 * Retrieve full permalink for current post or post ID. 107 * 108 * @since 1.0.0 109 * 110 * @param int|WP_Post $id Optional. Post ID or post object. Default current post. 111 * @param bool $leavename Optional. Whether to keep post name or page name. Default false. 112 * @return string|false The permalink URL or false if post does not exist. 113 */ 114 function get_permalink( $id = 0, $leavename = false ) { 115 function get_permalink( $post = 0, $leavename = false ) { 115 116 $rewritecode = array( 116 117 '%year%', … … 127 128 ); 128 129 129 if ( is_object($id) && isset($id->filter) && 'sample' == $id->filter ) { 130 $post = $id; 130 if ( is_object( $post ) && isset( $post->filter ) && 'sample' == $post->filter ) { 131 131 $sample = true; 132 132 } else { 133 $post = get_post( $id);133 $post = get_post( $post ); 134 134 $sample = false; 135 135 }
Note: See TracChangeset
for help on using the changeset viewer.