Changeset 24301 for trunk/wp-includes/post-template.php
- Timestamp:
- 05/20/2013 11:05:50 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r24207 r24301 161 161 * @param string $more_link_text Optional. Content for when there is more text. 162 162 * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. 163 */ 164 function the_content( $more_link_text = null, $strip_teaser = false ) { 165 $content = apply_filters( 'the_content', get_the_content( $more_link_text, $strip_teaser ) ); 163 * @param int $id Optional. A post id. Defaults to the current post when in The Loop, undefined otherwise. 164 */ 165 function the_content( $more_link_text = null, $strip_teaser = false, $id = 0 ) { 166 $post = get_post( $id ); 167 168 /* 169 * Filter: the_content 170 * 171 * param string Post content as returned by get_the_content() 172 * param int The ID of the post to which the content belongs. This was introduced 173 * in 3.6.0 and is not reliably passed by all plugins and themes that 174 * directly apply the_content. As such, it is not considered portable. 175 */ 176 $content = apply_filters( 'the_content', get_the_content( $more_link_text, $strip_teaser, $post->ID ), $post->ID ); 166 177 echo str_replace( ']]>', ']]>', $content ); 167 178 } … … 174 185 * @param string $more_link_text Optional. Content for when there is more text. 175 186 * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false. 187 * @param int $id Optional. A post id. Defaults to the current post when in The Loop, undefined otherwise. 176 188 * @return string 177 189 */ 178 function get_the_content( $more_link_text = null, $strip_teaser = false ) { 179 global $more, $page, $pages, $multipage, $preview; 180 181 $post = get_post(); 190 function get_the_content( $more_link_text = null, $strip_teaser = false, $id = 0 ) { 191 global $page, $more, $preview; 192 193 $post = get_post( $id ); 194 // Avoid parsing again if the post is the same one parsed by setup_postdata(). 195 // The extract() will set up $pages and $multipage. 196 if ( $post->ID != $GLOBALS['id'] ) 197 extract( wp_parse_post_content( $post, false ) ); 198 else 199 global $pages, $multipage; 182 200 183 201 if ( null === $more_link_text ) … … 188 206 189 207 // If post password required and it doesn't match the cookie. 190 if ( post_password_required( ) )191 return get_the_password_form( );208 if ( post_password_required( $post ) ) 209 return get_the_password_form( $post ); 192 210 193 211 if ( $page > count( $pages ) ) // if the requested page doesn't exist … … 567 585 * @since 2.7.0 568 586 * 569 * @param int| object $post An optional post. Global $post used if not provided.587 * @param int|WP_Post $post An optional post. Global $post used if not provided. 570 588 * @return bool false if a password is not required or the correct password cookie is present, true otherwise. 571 589 */ … … 1226 1244 * @since 1.0.0 1227 1245 * @uses apply_filters() Calls 'the_password_form' filter on output. 1228 * 1246 * @param int|WP_Post $post Optional. A post id or post object. Defaults to the current post when in The Loop, undefined otherwise. 1229 1247 * @return string HTML content for password form for password protected post. 1230 1248 */ 1231 function get_the_password_form( ) {1232 $post = get_post( );1249 function get_the_password_form( $post = 0 ) { 1250 $post = get_post( $post ); 1233 1251 $label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID ); 1234 1252 $output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">
Note: See TracChangeset
for help on using the changeset viewer.