get_the_content [ WordPress Function ]
get_the_content ( $more_link_text = null, $stripteaser = false )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: get_the_content_feed, the_content, get_the_time, get_the_date, the_content_rss
Retrieve the post content.
Source
<?php
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) )
return get_the_password_form();
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);
}
}
if ( $preview ) // preview fix for javascript bug with foreign languages
$output = preg_replace_callback('/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output);
return $output;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/get the content « WordPress Codex
Description. Retrieve the post content. (Must be used in a Loop). Usage. <?php get_the_content( $more_link_text, $stripteaser, $more_file ) ?> Parameters ...
codex.wordpress.org - WordPress › Support » get_the_content with <p>
I'm trying to get the post content, using get_the_content() to make a plugin that translates my blog posts from Spanish to English. The problem is when I use in ...
wordpress.org - get_the_content() WITH formatting – Wordpress hack for the_content ...
Aug 31, 2008 ... Normally the get_the_content() tag returns the content without formatting. I found out a solution to make get_the_content() tag return the ...
www.web-templates.nu - How do I get_the_content in a custom walker? - WordPress
Feb 14, 2012 ... I have a custom walker and I would like to either get_the_content() (up to the Read More) or get_the_excerpt() to use in this walker, but I can't ...
wordpress.stackexchange.com
Gebruikersdiscussies [ wordpress.org ]
- mtpultz on "How to add custom text between content and more link in the_content"
- Mat Lipe on "How to add custom text between content and more link in the_content"
- Mat Lipe on "How to add custom text between content and more link in the_content"
- mtpultz on "How to add custom text between content and more link in the_content"
- Mat Lipe on "How to add custom text between content and more link in the_content"
- Mat Lipe on "How to add custom text between content and more link in the_content"
- mtpultz on "How to add custom text between content and more link in the_content"
- dcarmo on "grabbing full posts when the page has a more section"
- Sam Scholfield on "grabbing full posts when the page has a more section"
- dcarmo on "grabbing full posts when the page has a more section"