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.


  • 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);



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: