您可以将其格式化为,也无需将echo
<?php next_post_link(\'%link\',"<img src=" . CFS()->get(\'image_location\') . "/>"); ?>
CFS()->get(\'image_location\')
获取基于当前帖子id的字段。如果要在下一篇或上一篇文章中使用该字段,则必须传递下一篇或上一篇文章id。
您可以这样做:
$next_post = get_adjacent_post( true, \'\', false, \'taxonomy_slug\' );
$next_post_id = \'\';
if ( is_a( $next_post, \'WP_Post\' ) )
$next_post_id = $next_post->ID;
if ( ! empty( $next_post_id ) ) {
$next_post_image_source = CFS()->get( \'image_location\', $next_post_id );
} else {
$next_post_image_source = "default image";
}
next_post_link(\'%link\',"<img src=" . $next_post_image_source . "/>");
不能保证这会起作用,但从这里继续应该很容易