Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <?php
  2. $args=array(
  3. 'post_type' => 'festivals',
  4. 'orderby' => 'title',
  5. 'order' => 'ASC',
  6. 'posts_per_page'=>-1,
  7. 'caller_get_posts'=>1,
  8. 'meta_key' => 'festival_year',
  9. 'meta_value' => '2012',
  10. );
  11. $my_query = new WP_Query($args);
  12. if( $my_query->have_posts() ) {
  13. echo 'Total Number of Festival Guides: ' . count($my_query->posts) . '';
  14. while ($my_query->have_posts()) : $my_query->the_post();
  15. $this_char = strtoupper(substr($post->post_title,0,1));
  16. if ($this_char != $last_char) {
  17. $last_char = $this_char;
  18. echo '<h4>'.$last_char.'</h4>';
  19. } ?>
  20.  
  21. <div itemscope itemtype="http://schema.org/Festival">
  22. <p><a itemprop="url" href="<?php the_permalink(); ?>"><span itemprop="name"><?php the_title(); ?></span></a> </p>
  23. </div>
  24.  
  25. <?php endwhile;
  26. } //if ($my_query)
  27. wp_reset_query(); // Restore global post data stomped by the_post().
  28. ?>
  29. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement