你好@Jeremy Love:
好问题!这是一个很好的问题,因为似乎没有任何挂钩允许您编写代码以按作者过滤。
遗憾的是,这意味着要复制他们的副本来创建自己的函数,这样您就可以进行所需的1行更改(在这种情况下\'post_author\' => $post->post_author,
).以下是您应该能够使用的函数:
function yoursite_previous_image_link($size = \'thumbnail\', $text = false) {
yoursite_adjacent_image_link(true, $size, $text);
}
function yoursite_next_image_link($size = \'thumbnail\', $text = false) {
yoursite_adjacent_image_link(false, $size, $text);
}
function yoursite_adjacent_image_link($prev=true,$size=\'thumbnail\',$text=false) {
global $post;
$post = get_post($post);
$attachments = array_values(get_children( array(
\'post_author\' => $post->post_author,
\'post_parent\' => $post->post_parent,
\'post_status\' => \'inherit\',
\'post_type\' => \'attachment\',
\'post_mime_type\' => \'image\',
\'order\' => \'ASC\',
\'orderby\' => \'menu_order ID\'
)));
foreach ( $attachments as $k => $attachment )
if ( $attachment->ID == $post->ID )
break;
$k = $prev ? $k - 1 : $k + 1;
if ( isset($attachments[$k]) )
echo wp_get_attachment_link($attachments[$k]->ID, $size, true, false, $text);
}