Advertisement
Guest User

two loops with pagination in second loop

a guest
Oct 14th, 2011
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.87 KB | None | 0 0
  1. ----- header.php -----
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml"><head>
  5. <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
  6.  
  7. <title>Untitled</title>
  8.  
  9. <?php wp_head(); ?>
  10.  
  11. </head>
  12.  
  13. <body>
  14.  
  15. ----- index.php ----
  16.  
  17. <?php get_header() ?>
  18. <br />
  19. HIGHLIGHTS (3) <br />
  20.             <?php query_posts('showposts=3&cat=4,6,8,9');?>
  21.  
  22.             <?php if (have_posts()) : ?>
  23.  
  24.                 <?php while (have_posts()) : the_post(); ?>
  25.  
  26.  
  27.                         <span><?php the_time('d.m.Y'); ?></span>
  28.  
  29.                         <h3 class="cat-<?php echo $category[0]->cat_ID ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Leia: <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
  30.              
  31.             <?php endwhile; ?>
  32.  
  33.                 <?php else : ?>
  34.  
  35.             <?php endif; ?>
  36.  
  37. <?php wp_reset_query(); ?>
  38.  
  39. <hr />
  40. <br />
  41. POSTS <br />
  42.  
  43. <?php
  44. $last_three = get_posts('cat=4,6,8,9&numberposts=3');
  45. $last_three_ids = array();
  46. if( $last_three ) foreach( $last_three as $last_post ) { $last_three_ids[] = $last_post->ID; }
  47.  
  48. $query = new WP_Query(array('cat' => '4,6,8,9', 'post__not_in' => $last_three_ids, 'posts_per_page' => 8, 'paged' => get_query_var('paged') ) );  ?>
  49.  
  50.                 <?php if ($query->have_posts()) : while($query->have_posts()) : $query->the_post(); ?>
  51.  
  52.                         <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Leia: <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
  53.  
  54.                         <p><?php echo excerpt(20); ?> </p>
  55.  
  56.                 <?php endwhile; ?>
  57.  
  58.                     <?php if(function_exists('wp_pagenavi')) : wp_pagenavi(array( 'query' => $query )); endif; ?>
  59.                    
  60.                 <?php else : ?>
  61.  
  62.                 <?php endif; ?>
  63. <?php get_footer() ?>
  64.  
  65. ----- footer.php -----
  66.  
  67. <?php wp_footer(); ?>
  68.  
  69. </body>
  70.  
  71. </html>
  72.  
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement