WordPress.org

Make WordPress Core

Ticket #10984: 10984.diff

File 10984.diff, 1.8 KB (added by westi, 5 years ago)

Alternative patch - add support for get_the_content ignoring pagination.

  • wp-includes/feed.php

     
    144144        if ( !$feed_type ) 
    145145                $feed_type = get_default_feed(); 
    146146 
    147         $content = apply_filters('the_content', get_the_content()); 
     147        $content = apply_filters('the_content', get_the_content(null, 0, true)); 
    148148        $content = str_replace(']]>', ']]>', $content); 
    149149        return apply_filters('the_content_feed', $content, $feed_type); 
    150150} 
  • wp-includes/post-template.php

     
    175175 * 
    176176 * @param string $more_link_text Optional. Content for when there is more text. 
    177177 * @param string $stripteaser Optional. Teaser content before the more text. 
     178 * @param bool $ignorepagination Optional. Whether of not to ignore the pagination in the post and return all pages. Defaults to false. 
    178179 * @return string 
    179180 */ 
    180 function get_the_content($more_link_text = null, $stripteaser = 0) { 
     181function get_the_content($more_link_text = null, $stripteaser = 0, $ignorepagination = false) { 
    181182        global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow; 
    182183 
    183184        if ( null === $more_link_text ) 
     
    195196        if ( $page > count($pages) ) // if the requested page doesn't exist 
    196197                $page = count($pages); // give them the highest numbered page that DOES exist 
    197198 
    198         $content = $pages[$page-1]; 
     199        if ( $ignorepagination ) { 
     200                $content = implode("\n", $pages); 
     201        } else { 
     202                $content = $pages[$page-1]; 
     203        } 
     204         
    199205        if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) { 
    200206                $content = explode($matches[0], $content, 2); 
    201207                if ( !empty($matches[1]) && !empty($more_link_text) )