Definition:
function get_the_content($more_link_text = null, $stripteaser = false) {}
Retrieve the post content.
Parameters
- string $more_link_text: Optional. Content for when there is more text.
- bool $stripteaser: Optional. Strip teaser content before the more text. Default is false.
Defined filters
- the_content_more_link
apply_filters( 'the_content_more_link', ' <a href="' . get_permalink()
Source code
function get_the_content($more_link_text = null, $stripteaser = false) { global $post, $more, $page, $pages, $multipage, $preview; if ( null === $more_link_text ) $more_link_text = __( '(more...)' ); $output = ''; $hasTeaser = false; // If post password required and it doesn't match the cookie. if ( post_password_required($post) ) { $output = get_the_password_form(); return $output; } if ( $page > count($pages) ) // if the requested page doesn't exist $page = count($pages); // give them the highest numbered page that DOES exist $content = $pages[$page-1]; if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) { $content = explode($matches[0], $content, 2); if ( !empty($matches[1]) && !empty($more_link_text) ) $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1]))); $hasTeaser = true; } else { $content = array($content); } if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) ) $stripteaser = true; $teaser = $content[0]; if ( $more && $stripteaser && $hasTeaser ) $teaser = ''; $output .= $teaser; if ( count($content) > 1 ) { if ( $more ) { $output .= '<span id="more-' . $post->ID . '"></span>' . $content[1]; } else { if ( ! empty($more_link_text) ) $output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text ); $output = force_balance_tags($output); } }
1823
No comments yet... Be the first to leave a reply!