| | 3016 | * Set up global post data. |
| | 3017 | * |
| | 3018 | * @param object $post Post data. |
| | 3019 | * @uses do_action_ref_array() Calls 'the_post' |
| | 3020 | * @return bool True when finished. |
| | 3021 | */ |
| | 3022 | function setup_postdata($post) { |
| | 3023 | global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages; |
| | 3024 | |
| | 3025 | $id = (int) $post->ID; |
| | 3026 | |
| | 3027 | $authordata = get_userdata($post->post_author); |
| | 3028 | |
| | 3029 | $currentday = mysql2date('d.m.y', $post->post_date, false); |
| | 3030 | $currentmonth = mysql2date('m', $post->post_date, false); |
| | 3031 | $numpages = 1; |
| | 3032 | $page = $this->get('page'); |
| | 3033 | if ( !$page ) |
| | 3034 | $page = 1; |
| | 3035 | |
| | 3036 | if ( $this->is_single() || $this->is_page() || $this->is_feed() ) |
| | 3037 | $more = 1; |
| | 3038 | $content = $post->post_content; |
| | 3039 | if ( strpos( $content, '<!--nextpage-->' ) ) { |
| | 3040 | if ( $page > 1 ) |
| | 3041 | $more = 1; |
| | 3042 | $multipage = 1; |
| | 3043 | $content = str_replace("\n<!--nextpage-->\n", '<!--nextpage-->', $content); |
| | 3044 | $content = str_replace("\n<!--nextpage-->", '<!--nextpage-->', $content); |
| | 3045 | $content = str_replace("<!--nextpage-->\n", '<!--nextpage-->', $content); |
| | 3046 | $pages = explode('<!--nextpage-->', $content); |
| | 3047 | $numpages = count($pages); |
| | 3048 | } else { |
| | 3049 | $pages = array( $post->post_content ); |
| | 3050 | $multipage = 0; |
| | 3051 | } |
| | 3052 | |
| | 3053 | do_action_ref_array('the_post', array(&$post)); |
| | 3054 | |
| | 3055 | return true; |
| | 3056 | } |
| | 3057 | |
| | 3058 | |
| | 3059 | /** |
| 3596 | | $currentday = mysql2date('d.m.y', $post->post_date, false); |
| 3597 | | $currentmonth = mysql2date('m', $post->post_date, false); |
| 3598 | | $numpages = 1; |
| 3599 | | $page = get_query_var('page'); |
| 3600 | | if ( !$page ) |
| 3601 | | $page = 1; |
| 3602 | | if ( is_single() || is_page() || is_feed() ) |
| 3603 | | $more = 1; |
| 3604 | | $content = $post->post_content; |
| 3605 | | if ( strpos( $content, '<!--nextpage-->' ) ) { |
| 3606 | | if ( $page > 1 ) |
| 3607 | | $more = 1; |
| 3608 | | $multipage = 1; |
| 3609 | | $content = str_replace("\n<!--nextpage-->\n", '<!--nextpage-->', $content); |
| 3610 | | $content = str_replace("\n<!--nextpage-->", '<!--nextpage-->', $content); |
| 3611 | | $content = str_replace("<!--nextpage-->\n", '<!--nextpage-->', $content); |
| 3612 | | $pages = explode('<!--nextpage-->', $content); |
| 3613 | | $numpages = count($pages); |
| 3614 | | } else { |
| 3615 | | $pages = array( $post->post_content ); |
| 3616 | | $multipage = 0; |
| | 3636 | if ( is_a( $wp_query, 'WP_Query' ) ) { |
| | 3637 | return $wp_query->setup_postdata( $post ); |