Php Can';让Jetpack无限卷轴在自定义WordPress主题下工作
我正在为一个客户端制作一个自定义WordPress站点,我想在其中实现对我的归档和分类模板的无限滚动 我使用以下方法来实现这一目标:Php Can';让Jetpack无限卷轴在自定义WordPress主题下工作,php,jquery,wordpress,infinite-scroll,jetpack,Php,Jquery,Wordpress,Infinite Scroll,Jetpack,我正在为一个客户端制作一个自定义WordPress站点,我想在其中实现对我的归档和分类模板的无限滚动 我使用以下方法来实现这一目标: HTML5空白WordPress框架 JetpackWordPress插件 引导程序3 我在互联网上读过几篇文章和教程,解释了如何实现这一功能,一切看起来都非常简单,但由于任何原因,我都无法让它正常工作 插件被激活,并且激活了它的无限滚动模块 我按照这里写的说明进行操作: 我的category.php中有以下代码(我在这里进行所有测试),请注意,所有内容都封装
- HTML5空白WordPress框架
- JetpackWordPress插件
- 引导程序3
- 添加“render”参数,并尝试加载模板部分 获取模板部分('content','category')李>
- 在“类型”参数中同时使用“单击”和“滚动”
- 通过自定义功能添加无限滚动支持(仅限于 我在上面所做的)以及在 my functions.php的functions块
- 几乎尝试了无限卷轴的所有自定义参数 功能(尝试和错误)
<div id="content">
<?php if ( have_posts() ) : ?>
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
get_template_part( 'content', 'category' );
// End the loop.
endwhile;
// If no content, include the "No posts found" template.
else :
get_template_part( 'content', 'none' );
endif;
?>
</div>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<!-- row -->
<div class="row">
<div class="col-xs-12 col-sm-6">
<!-- post thumbnail -->
<?php if ( has_post_thumbnail()) : // Check if thumbnail exists ?>
<div class="thumb">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<div class="icono-redondo-negro">
<?php
$format = get_post_format();
if ( false === $format ) :
?>
<i class="fa fa-file-text"></i>
<?php endif; ?>
<?php if ( has_post_format( 'gallery' )) : ?>
<i class="fa fa-picture-o"></i>
<?php elseif ( has_post_format( 'video' )) : ?>
<i class="fa fa-video-camera"></i>
<?php elseif ( has_post_format( 'audio' )) : ?>
<i class="fa fa-headphones"></i>
<?php endif; ?>
</div>
<?php the_post_thumbnail('categoria-thumb'); ?>
<span class="plus">+</span>
</a>
</div>
<?php endif; ?>
<!-- /post thumbnail -->
</div>
<div class="col-xs-12 col-sm-6">
<p class="fecha"><?php the_time('j \d\e\ F, Y'); ?> | <?php the_time('g:i a'); ?></p>
<!-- post title -->
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<h1 class="titulo"><?php the_title(); ?></h1>
</a>
<!-- /post title -->
<!-- post excerpt -->
<p><?php html5wp_excerpt('html5wp_index'); // Build your custom callback length in functions.php ?></p>
<!-- /post excerpt -->
<?php edit_post_link(); ?>
</div>
</div>
<!-- /row -->
</article>
function raramuri_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
'container' => 'content',
'type' => 'click',
'footer' => false,
));
}
add_action('init', 'raramuri_infinite_scroll_init');