previous_post()
Устарела с версии 2.0.0. Больше не поддерживается и может быть удалена. Используйте previous_post_link().
Prints a link to the previous post.
Хуки из функции
Возвращает
null
. Ничего (null).
Использование
previous_post( $format, $previous, $title, $in_same_cat, $limitprev, $excluded_categories );
- $format(строка)
- -
По умолчанию: '%' - $previous(строка)
- -
По умолчанию: 'previous post: ' - $title(строка)
- -
По умолчанию: 'yes' - $in_same_cat(строка)
- -
По умолчанию: 'no' - $limitprev(int)
- -
По умолчанию: 1 - $excluded_categories(строка)
- -
По умолчанию: ''
Заметки
- Смотрите: previous_post_link()
Список изменений
С версии 1.5.0 | Введена. |
Устарела с 2.0.0 | Use previous_post_link() |
Код previous_post() previous post WP 6.8
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; }