Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Can';让Jetpack无限卷轴在自定义WordPress主题下工作_Php_Jquery_Wordpress_Infinite Scroll_Jetpack - Fatal编程技术网

Php Can';让Jetpack无限卷轴在自定义WordPress主题下工作

Php Can';让Jetpack无限卷轴在自定义WordPress主题下工作,php,jquery,wordpress,infinite-scroll,jetpack,Php,Jquery,Wordpress,Infinite Scroll,Jetpack,我正在为一个客户端制作一个自定义WordPress站点,我想在其中实现对我的归档和分类模板的无限滚动 我使用以下方法来实现这一目标: HTML5空白WordPress框架 JetpackWordPress插件 引导程序3 我在互联网上读过几篇文章和教程,解释了如何实现这一功能,一切看起来都非常简单,但由于任何原因,我都无法让它正常工作 插件被激活,并且激活了它的无限滚动模块 我按照这里写的说明进行操作: 我的category.php中有以下代码(我在这里进行所有测试),请注意,所有内容都封装

我正在为一个客户端制作一个自定义WordPress站点,我想在其中实现对我的归档和分类模板的无限滚动

我使用以下方法来实现这一目标:

  • HTML5空白WordPress框架
  • JetpackWordPress插件
  • 引导程序3
我在互联网上读过几篇文章和教程,解释了如何实现这一功能,一切看起来都非常简单,但由于任何原因,我都无法让它正常工作

插件被激活,并且激活了它的无限滚动模块

我按照这里写的说明进行操作:

我的category.php中有以下代码(我在这里进行所有测试),请注意,所有内容都封装在一个id为“content”的div中:

我尝试过以下几种方法:

  • 添加“render”参数,并尝试加载模板部分 获取模板部分('content','category')
  • 在“类型”参数中同时使用“单击”和“滚动”
  • 通过自定义功能添加无限滚动支持(仅限于 我在上面所做的)以及在 my functions.php的functions块
  • 几乎尝试了无限卷轴的所有自定义参数 功能(尝试和错误)
到目前为止,一切都不起作用,我在向下滚动时看不到“加载gif图标”,在使用click版本时也看不到“显示更多帖子”按钮

我认为这可能是与HTML5不兼容,或者我没有以正确的方式实现无限滚动支持

我想有“显示更多的帖子”按钮,以便用户可以加载更多的,因为他们希望

我错过什么了吗?提前感谢您的帮助

<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');