Definition:
function get_extended($post) {}
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.
Parameters
- string $post: Post content.
Return values
returns:Post before (‘main’) and after (‘extended’).
Source code
function get_extended($post) { //Match the new style more links if ( preg_match('/<!--more(.*?)?-->/', $post, $matches) ) { list($main, $extended) = explode($matches[0], $post, 2); } else { $main = $post; $extended = ''; } // Strip leading and trailing whitespace $main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main); $extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended); return array('main' => $main, 'extended' => $extended); }
1386
No comments yet... Be the first to leave a reply!