Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 3rd, 2012  |  syntax: None  |  size: 0.90 KB  |  views: 24  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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>