Advertisements

previous_post

Definition:
function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {}

Prints link to the previous post.

Parameters

  • string $format
  • string $previous
  • string $title
  • string $in_same_cat
  • int $limitprev
  • string $excluded_categories

Defined filters

  • the_title
    apply_filters('the_title', $post->post_title, $post->ID)

Source code

function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {



	_deprecated_function( __FUNCTION__, '2.0', 'previous_post_link()' );



	if ( empty($in_same_cat) || 'no' == $in_same_cat )

		$in_same_cat = false;

	else

		$in_same_cat = true;



	$post = get_previous_post($in_same_cat, $excluded_categories);



	if ( !$post )

		return;



	$string = '<a href="'.get_permalink($post->ID).'">'.$previous;

	if ( 'yes' == $title )

		$string .= apply_filters('the_title', $post->post_title, $post->ID);

	$string .= '</a>';

	$format = str_replace('%', $string, $format);

	echo $format;

}

2611

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: