2013-08-26 50 views
0

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

很拉不同的附加类别和分页 去任何地方,但在第一页的模板之一..

能有人来看看到底是怎么回事?

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

回答

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),)); ?> 

感谢帮助我,但我发现了一篇文章,并将此查询中,固定有关分页 我的问题。

相关问题