Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $last_char = '';
- $args=array(
- 'orderby' => 'title',
- 'order' => 'ASC',
- 'posts_per_page'=>-1,
- 'caller_get_posts'=>1,
- 'tag'=>"como-usar",
- );
- $my_query = new WP_Query($args);
- if( $my_query->have_posts() ) {
- /*echo 'Alphabetic index of all ' . count($my_query->posts) . ' posts';*/
- while ($my_query->have_posts()) : $my_query->the_post();
- $this_char = strtoupper(substr($post->post_title,0,1));
- if ($this_char != $last_char) {
- $last_char = $this_char;
- echo '<h2 class="a-z-titulo">'.$last_char.'</h2>';
- } ?>
- <div class="item">
- <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
- <?php echo get_the_post_thumbnail( $post_id, array( 100, 100) );?>
- <?php the_title(); ?>
- </a>
- </div>
- <?php
- endwhile;
- } //if ($my_query)
- wp_reset_query(); // Restore global post data stomped by the_post().
- ?>
Advertisement
Add Comment
Please, Sign In to add comment