Advertisements

get_extended

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

Advertisements

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:

WordPress.com Logo

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

Google+ photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: