Un motore di ricerca WordPress per sviluppatori e autori di temi



previous_post ›

Da1.5.0
Deprecato2.0.0
previous_post ( $format = '%', $previous = 'previous post: ', $title = 'yes', $in_same_cat = 'no', $limitprev = 1, $excluded_categories = '' )
Parametri: (6)
  • (string) $format
    Richiesto: No
    Default: '%'
  • (string) $previous
    Richiesto: No
    Default: 'previous post: '
  • (string) $title
    Richiesto: No
    Default: 'yes'
  • (string) $in_same_cat
    Richiesto: No
    Default: 'no'
  • (int) $limitprev
    Richiesto: No
    Default: 1
  • (string) $excluded_categories
    Richiesto: No
    Default: (vuoto)
Vedi:
Definito a:
Codex:

Prints a link to the previous post.



Sorgenti

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

	_deprecated_function( __FUNCTION__, '2.0.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;
}