[метод]
term_id;
$lastposts = get_posts('numberposts=all&category='.$cat_id);
foreach($lastposts as $post) {
}
$title = $post->post_title;
if ( empty($post->post_title) )
$title = __('Next Post');
$title = apply_filters('the_title', $title, $post);
$string = '';
$link = str_replace('%title', $title, $link);
$link = $string . $link . '';
$format = str_replace('%link', $link, $format);
echo $format;
}else {
$title = $post->post_title;
if ( empty($post->post_title) )
$title = __('Next Post');
$title = apply_filters('the_title', $title, $post);
$string = '';
$link = str_replace('%title', $title, $link);
$link = $string . $link . '';
$format = str_replace('%link', $link, $format);
echo $format;
}
}
?>
post_parent);
else
$post = get_previous_post($in_same_cat, $excluded_categories);
if ( !$post ){
$categories = get_the_category();
$cat_id = $categories[0]->term_id;
$lastposts = get_posts('numberposts=all&category='.$cat_id);
$post = $lastposts[0];
$title = $post->post_title;
if ( empty($post->post_title) )
$title = __('Next Post');
$title = apply_filters('the_title', $title, $post);
$string = '';
$link = str_replace('%title', $title, $link);
$link = $string . $link . '';
$format = str_replace('%link', $link, $format);
echo $format;
}else {
$title = $post->post_title;
if ( empty($post->post_title) )
$title = __('Previous Post');
$title = apply_filters('the_title', $title, $post);
$string = '';
$link = str_replace('%title', $title, $link);
$link = $pre . $string . $link . '';
$format = str_replace('%link', $link, $format);
echo $format;
}
}
?>