関数 setup_postdata()
2014/12/16
関数 setup_postdata()
定義ファイル :/blog/wp-includes/query.php 9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | function setup_postdata( $post ) { global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages; $id = (int) $post->ID; $authordata = get_userdata($post->post_author); $currentday = mysql2date('d.m.y', $post->post_date, false); $currentmonth = mysql2date('m', $post->post_date, false); $numpages = 1; $multipage = 0; $page = get_query_var('page'); if ( ! $page ) $page = 1; if ( is_single() || is_page() || is_feed() ) $more = 1; $content = $post->post_content; if ( false !== strpos( $content, '<!--nextpage-->' ) ) { if ( $page > 1 ) $more = 1; $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content ); $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content ); $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content ); // Ignore nextpage at the beginning of the content. if ( 0 === strpos( $content, '<!--nextpage-->' ) ) $content = substr( $content, 15 ); $pages = explode('<!--nextpage-->', $content); $numpages = count($pages); if ( $numpages > 1 ) $multipage = 1; } else { $pages = array( $post->post_content ); } do_action_ref_array( 'the_post', array( &$post ) ); return true; } |