我目前有一个自定义的归档页面,在顶部显示我当前的帖子,然后在下面链接到我以前的所有帖子。然而,我需要分解页面,以便它显示当前帖子,然后在下面显示当前月份的帖子。我想使用jQuery无限滚动插件逐月显示较旧的帖子,当他们向下滚动页面时,它会自动加载下个月的帖子。
以下是我必须显示当前帖子的代码:
<?php get_header(); ?>
<div id="members-msg" class="para-element" data-offset="-0.1">
<div class="third fleft">
<?php
global $post;
$tmp_post = $post;
$args = array( \'numberposts\' => 1, \'category\' => 6 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a>
<?/* <?php the_excerpt(); ?> */?>
<?php the_content();?>
<?php endforeach; ?>
</div>
<div class="twothirds fright">
<div id="slider-con">
<ul id="slider">
<?php
$args = array( \'post_type\' => \'attachment\', \'numberposts\' => -1, \'post_status\' => null, \'post_parent\' => $post->ID );
$attachments = get_posts($args);
if ($attachments) {
foreach ( $attachments as $attachment ) {
echo \'<li>\';
the_attachment_link( $attachment->ID , \'full\' );
echo \'</li>\';
}
}
?>
</ul>
<?php $post = $tmp_post; ?>
</div>
</div>
</div>
</div>
</div>
以下是我必须显示旧帖子的代码:
<div id="reason-header" class="row-fluid">
<div class="parallax">
<div class="para-element" data-offset="-0.3">
<h3>Browse <span>Our</span> Archives</h3>
</div>
<div id="reasons-hdr" class="para-image" data-offset="-0.8">
</div>
</div>
</div>
<div id="all-posts">
<div class="content">
<?php
global $post;
$tmp_post = $post;
$myposts = get_posts(\'numberposts=-1&category=6&orderby=date&order=DESC\');
foreach($myposts as $post) :
?>
<?php
setup_postdata($post);
$size = \'thumb\';
$images = get_children(array(
\'post_type\' => \'attachment\',
\'numberposts\' => 1,
\'post_status\' => null,
\'post_parent\' => $post->ID));
foreach($images as $image){
$attachment = wp_get_attachment_image_src($image->ID, $size);
?>
<div class="rea-con" style="background: url(<?php echo
$attachment[0]; ?>) no-repeat center center;">
<h4><a href="<?php the_permalink(); ?>" title="<?php the_title();?>"><?php the_title(); ?></a></h4>
</div>
<?php } ?>
<?php endforeach; ?>
<?php $post = $tmp_post; ?>
</div>
</div>
我如何分解旧帖子代码的部分,使其在默认情况下只回拉当前月份的帖子,然后当它们向下滚动时,它将自动显示前几个月的帖子,然后当它们向下滚动更多时,它将自动显示前一个月的帖子?
我想使用jQuery无限滚动插件来实现这一点。
非常感谢您的帮助。
谢谢