Advertisement
Guest User

Untitled

a guest
Jun 14th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <?php
  2. /**
  3. * The exhibitions archive template file.
  4. *
  5. */
  6.  
  7. get_header(); ?>
  8.  
  9. <?php get_sidebar(); ?>
  10.  
  11. <div id="content">
  12.  
  13. <div class="post">
  14.  
  15. <?php
  16.  
  17. $page1 = (get_query_var('paged')) ? get_query_var('paged') : 1;
  18. $temp = $wp_query;
  19. $wp_query = null;
  20.  
  21. $year = date('Y');
  22.  
  23. $wp_query = new WP_Query();
  24. $wp_query -> query('post_type=exhibitions&paged='. $page1 .'&posts_per_page=2');
  25. while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
  26.  
  27.  
  28. <div class="columns">
  29.  
  30. <?php echo $year ?>
  31.  
  32. </div>
  33. <div class="columns">
  34.  
  35.  
  36. <?php
  37.  
  38. $page2 = (get_query_var('paged')) ? get_query_var('paged') : 1;
  39. $temp_query = $year_count;
  40. $temp_query = null;
  41.  
  42. $year_count = new WP_Query();
  43. $year_count -> query('post_type=exhibitions&year='. $year-- .'&paged=' .$page2);
  44. while ($year_count->have_posts()) : $year_count->the_post(); ?>
  45.  
  46. <div class="item">
  47. <?php if(get_field('artists')) {
  48. echo '<p>' . get_field('artists') . '</p>';
  49. } ?>
  50. <p><?php the_title(); ?></p>
  51. <?php if(get_field('dates')) {
  52. echo '<p>' . get_field('dates') . '</p>';
  53. } ?>
  54. </div>
  55.  
  56. <?php endwhile; ?>
  57. </div>
  58.  
  59. <?php if (isset($year_count)) {$temp_query = null; $year_count = $temp_query; wp_reset_query();} // restore loop
  60. endwhile;
  61. ?>
  62.  
  63. </div>
  64.  
  65. <div class="pagenav">
  66. <div class="alignleft"><?php previous_posts_link('Previous') ?></div>
  67. <div class="alignright"><?php next_posts_link('Next') ?></div>
  68. </div>
  69. <?php $wp_query = null; $wp_query = $temp; ?><?php wp_reset_query(); ?>
  70.  
  71. </div>
  72.  
  73.  
  74.  
  75. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement