通过wordpress中的“显示更多”按钮分页

时间:2014-06-19 14:39:51

标签: javascript php jquery ajax wordpress

我有一个WordPress索引页面,显示图像描绘的12个帖子。如果有更多帖子,则会在页面底部显示更多图像。

当您点击显示更多时,它应显示接下来的12个帖子图片。现在它加载了12个以上的帖子图片,但前12个帖子是相同的,并且样式不会从前12个帖子中继承。

<?php
    $category_ID = get_category_id('blog');
    $args = array(
         'post_type' => 'post',
         //'posts_per_page' => 12,
         'post__not_in' => $slider_arr,
         'cat' => '-' . $category_ID
         );
    $the_query = new WP_Query($args);
    while ($the_query->have_posts() ) : $the_query->the_post(); ?>  
    <div class="post">
        <div class="item stalac_box">
            <span class="stalac_box_img">
                <?php if(get_post_meta( get_the_ID(), 'page_featured_type', true ) == 'youtube') { ?>
                    <iframe width="560" height="315" src="http://www.youtube.com/embed/<?php echo get_post_meta( get_the_ID(), 'page_video_id', true ); ?>" frameborder="0" allowfullscreen></iframe>
                <?php } elseif(get_post_meta( get_the_ID(), 'page_featured_type', true ) == 'vimeo') { ?>
                    <iframe src="http://player.vimeo.com/video/<?php echo get_post_meta( get_the_ID(), 'page_video_id', true ); ?>?title=0&amp;byline=0&amp;portrait=0&amp;color=3399ff" width="500" height="338" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
                <?php } else { ?>
                    <?php //the_post_thumbnail('stalac-image'); ?>
                    <?php the_post_thumbnail('large'); ?>
                    <a class="stalac_box_hover" href="<?php the_permalink(); ?>">
                        <span class="stalac_box_hover_inside_tbl">
                            <span class="stalac_box_hover_inside_row">
                                <span class="stalac_box_hover_inside_cell">
                                    <h3><?php the_title(); ?></h3>
                                    <p><?php echo ds_get_excerpt('160'); ?></p>
                                </span> <!-- //stalac_box_hover_inside_cell -->
                            </span> <!-- //stalac_box_hover_inside_row -->
                        </span> <!-- //stalac_box_hover_tbl -->
                    </a> <!-- //stalac_box_hover -->
                <?php } ?>                                              
            </span> <!-- //stalac_box_img -->

        </div> <!-- //stalac_box -->
    </div> <!-- //post -->

    <?php endwhile; ?>                                                  
    <?php wp_reset_postdata(); ?>

0 个答案:

没有答案