令人惊讶的是,我自己找到了答案。。。
我使用的功能与我在下一篇/上一篇文章中使用的功能相同
(get_Nexting_post())但是发送下一篇/上一篇文章,我已经找到了它作为参数
$in_same_cat = true;
$excluded_categories = \'\';
$previous = true;
$previous_post = get_adjacent_post($in_same_cat,$excluded_categories,$previous);
$previous_previous_post =
get_adjacent_post($in_same_cat,$excluded_categories,$previous,$previous_post);
$previous = false;
$next_post = get_adjacent_post($in_same_cat,$excluded_categories,$previous);
$next_next_post = get_adjacent_post($in_same_cat,$excluded_categories,$previous,$next_post);
但是。。。我们还没有完成。。我们需要将此代码添加到wp includes/link模板中的函数声明中。php
function get_adjacent_post($in_same_cat = false, $excluded_categories = \'\', $previous = true,$mypost = null) {
global $wpdb;
//if specific post wasnt sent to function it takes the global one and checks if its empty before using it.
if ( empty( $mypost ) )
{
global $post;
if(empty( $post ))
return null;
$mypost=$post;
}
//...