get_extended [ WordPress Function ]
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Get extended entry info (<!--more-->).
There should not be any space after the second dash and before the word 'more'. There can be text or space(s) after the word 'more', but won't be referenced.
The returned array has 'main', 'extended', and 'more_text' keys. Main has the text before the
. The 'extended' key has the content after the
comment. The 'more_text' key has the custom "Read More" text.
Source
<?php
function get_extended($post) {
//Match the new style more links
if ( preg_match('/<!--more(.*?)?-->/', $post, $matches) ) {
list($main, $extended) = explode($matches[0], $post, 2);
$more_text = $matches[1];
} else {
$main = $post;
$extended = '';
$more_text = '';
}
// Strip leading and trailing whitespace
$main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);
$extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
$more_text = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $more_text);
return array( 'main' => $main, 'extended' => $extended, 'more_text' => $more_text );
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/get extended « WordPress Codex
Description. Get extended entry info ( <!--more--> ). There should not be any space after the second dash and before the word 'more'. There can be text or ...
codex.wordpress.org - WordPress Hidden Gem: get_extended() - Monday By Noon
Oct 26, 2009 ... WordPress' get_extended() function will let you pull copy based on the more flag. Definitely useful for advanced copy styling!
mondaybynoon.com - 関数リファレンス/get extended - WordPress Codex 日本語版
2010年4月27日 ... while ( have_posts() ) : the_posts(); $content = get_extended( $post ); echo '<p>' . ... get_extended() は wp-includes/post.php に含まれています。
wpdocs.sourceforge.jp - get_extended() WordPress function reference, arguments and ...
Get extended entry info (). There should not be any space after the second dash and before the word 'more'. There can be text or space(s) after the word 'more', ...
queryposts.com