我正在使用Wordpress并手动添加GitHub上paulirish的Infinte滚动:https://github.com/paulirish/infinite-scroll/
它可以正常加载,但如何在所有帖子周围添加包装?
基本上,我在一个<li>
标签我想添加一个<ol>
环绕/环绕帖子列表项。有什么想法吗?
作为参考,这是我在函数中使用的脚本。php文件:
/**
* Load Javascript for Infinte Scroll
*/
function custom_theme_js(){
wp_register_script( \'infinite_scroll\', get_template_directory_uri() . \'/js/jquery.infinitescroll.min.js\', array(\'jquery\'),null,true );
if( ! is_page_template( \'archive\' ) ) {
wp_enqueue_script(\'infinite_scroll\');
}
}
add_action(\'wp_enqueue_scripts\', \'custom_theme_js\');
/**
* Infinite Scroll
*/
function custom_infinite_scroll_js() {
if( ! is_page_template( \'archive\' ) ) { ?>
<script>
var infinite_scroll = {
loading: {
img: "<?php echo get_template_directory_uri(); ?>/images/ajax-loader.gif",
msgText: "<?php _e( \'Loading the next set of posts...\', \'custom\' ); ?>",
finishedMsg: "<?php _e( \'All posts loaded.\', \'custom\' ); ?>"
},
"nextSelector":".navigation .nav-next a",
"navSelector":".navigation",
"itemSelector":".archive-image",
"contentSelector":"#archive-content"
};
jQuery( infinite_scroll.contentSelector ).infinitescroll( infinite_scroll );
</script>
<?php
}
}
add_action( \'wp_footer\', \'custom_infinite_scroll_js\',100 );
谢谢!