0

我的分页没有在其中一个页面上工作,所以我在两个不同的模板上有相同的查询和代码,但代码的行为仍然不同。

它正在拉动不同的附加类别,并且分页无处可去,而是其中一个模板的第一页..

有人可以看看发生了什么吗?

<?php $blog = new WP_Query('cat=29'); ?>
        <?php while($blog->have_posts()): $blog->the_post(); ?>
        <?php $more = 0; ?>
        <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
            <?php
            $args = array(
                'post_type' => 'attachment',
                'numberposts' => '5',
                'post_status' => null,
                'post_parent' => $post->ID,
                'orderby' => 'menu_order',
                'order' => 'ASC',
                'exclude' => get_post_thumbnail_id()
            );
            $attachments = get_posts($args);
            if($attachments || has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)):
            ?>
            <div class="flexslider blog-medium-image floated-post-slideshow">
                <ul class="slides">
                    <?php if(get_post_meta(get_the_ID(), 'pyre_video', true)): ?>
                    <li class="video">
                        <?php echo get_post_meta(get_the_ID(), 'pyre_video', true); ?>
                    </li>
                    <?php endif; ?>
                    <?php if(has_post_thumbnail()): ?>
                    <?php $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?>
                    <?php $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); ?>
                    <li>
                        <div class="image">
                            <a href="<?php the_permalink(); ?>">
                                <?php the_post_thumbnail('blog-medium'); ?>
                                <?php if(count($attachments) == 0): ?>
                                <div class="image-extras">
                                    <div class="image-extras-content">
                                        <img src="<?php bloginfo('template_directory'); ?>/images/link-ico.png" alt="<?php the_title(); ?>"/>
                                        <h3><?php the_title(); ?></h3>
                                    </div>
                                </div>
                                <?php endif; ?>
                            </a>
                        </div>
                    </li>
                    <?php endif; ?>
                    <?php foreach($attachments as $attachment): ?>
                    <?php $attachment_image = wp_get_attachment_image_src($attachment->ID, 'blog-medium'); ?>
                    <?php $full_image = wp_get_attachment_image_src($attachment->ID, 'full'); ?>
                    <?php $attachment_data = wp_get_attachment_metadata($attachment->ID); ?>
                    <li>
                        <div class="image">
                            <a href="<?php the_permalink(); ?>">
                                <img src="<?php echo $attachment_image[0]; ?>" alt="<?php echo $attachment->post_title; ?>" />
                                <?php if(count($attachments) == 0): ?>
                                <div class="image-extras">
                                    <div class="image-extras-content">
                                        <img src="<?php bloginfo('template_directory'); ?>/images/link-ico.png" alt="<?php the_title(); ?>"/>
                                        <h3><?php the_title(); ?></h3>
                                    </div>
                                </div>
                                <?php endif; ?>
                            </a>
                        </div>
                    </li>
                    <?php endforeach; ?>
                </ul>
            </div>
            <?php endif; ?>
            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
            <div class="post-content">
                <?php the_content(''); ?>
            </div>
            <div class="meta-info">
                <div class="alignleft">
                    By <?php the_author_posts_link(); ?><span class="sep">|</span><?php the_category(', '); ?><span class="sep">|</span><?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?>
                </div>
                <div class="alignright">
                    <a href="<?php the_permalink(); ?>" class="read-more"><?php _e('Read More', 'Avada'); ?></a>
                </div>
            </div>
        </div>
        <?php endwhile; ?>
        <?php kriesi_pagination($blog->max_num_pages, $range = 2); ?>
4

1 回答 1

0
<?php $blog = new WP_Query( array ( 'posts_per_page' => '5','category__in' => array( 27, 28, 30 ),'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ), )); ?>

感谢您帮助我,但我找到了一篇文章并添加了此查询,其中解决了我关于分页的问题。

于 2013-08-27T15:04:29.383 回答