您可能需要定义一个新的循环函数,以便自定义Post类型传递给render
参数
如以下示例所示https://jetpack.com/support/infinite-scroll/
/**
* Add theme support for infinity scroll
*/
function twenty_ten_infinite_scroll_init() {
add_theme_support( \'infinite-scroll\', array(
\'container\' => \'content\',
\'render\' => \'twenty_ten_infinite_scroll_render\',
\'footer\' => \'wrapper\',
) );
}
add_action( \'after_setup_theme\', \'twenty_ten_infinite_scroll_init\' );
/**
* Set the code to be rendered on for calling posts,
* hooked to template parts when possible.
*
* Note: must define a loop.
*/
function twenty_ten_infinite_scroll_render() {
get_template_part( \'loop\' );
}
正如您所见,您可以调用该函数中的模板部分来生成下一批要显示的帖子(无限滚动将为您更新查询,因此您只需要一个循环模板)