我正在研究一个主题类型为“游览”的帖子。
我正在使用JetPack的无限滚动呈现新帖子:
function.php
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<li>
<a href="javascript:void(0);">Boxes <span class="drop-icon">▸</span> <label class="drop-icon" for="sm4" title="Toggle Drop-down">▾</label></a>
<input id="sm4" type="checkbox">
<ul class="sub-menu">
<li>
<a href="domain/admin/newintake.php" title="Add">New Intake <span style="float: right;" class="notification ni"></span></a>
</li>
<li>
<a href="domain/admin/bretrieval.php" title="Retrievals">Retrievals <span style="float: right;" class="notification retrievals"></span></a>
</li>
<li>
<a href="domain/admin/breturn.php" title="Returns">Returns <span style="float: right;" class="notification returns"></span></a>
</li>
<li>
<a href="domain/admin/bdestruct.php" title="Destructions">Destructions <span style="float: right;" class="notification destructions"></span></a>
</li>
<li>
<a href="domain/admin/bpretrieval.php" title="Permanent Box Retrieval">Permanent Retrieval <span style="float: right;" class="notification pretrieval"></span></a>
</li>
</ul>
</li>
<div class="total"></div>
首页
function tweakjp_custom_is_support() {
$supported = current_theme_supports( 'infinite-scroll' ) && ( is_home() || is_front_page() || is_archive() || is_single());
return $supported;
}
add_filter( 'infinite_scroll_archive_supported', 'tweakjp_custom_is_support' );
function my_child_infinite_scroll_render() {
while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_type());
endwhile;
}
function my_child_setup() {
add_theme_support( 'infinite-scroll', array(
'type' => 'scroll',
'container' => 'mob_infinite',
'render' => 'my_child_infinite_scroll_render',
'posts_per_page' => 2,
) );
}
add_action( 'after_setup_theme', 'my_child_setup' );