Advertisement
Guest User

animeSeries - first-letter.php(2)

a guest
May 30th, 2013
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Display posts based on letter.
  4.  *
  5.  * @package animeSeries
  6.  */
  7.  
  8. define('WP_USE_THEMES', false);
  9. require_once('../../../wp-load.php');
  10.  
  11. $letter = (isset($_GET['letter'])) ? $_GET['letter'] : 'a';
  12. query_posts('letter=' . $letter);
  13.  
  14. $end_col = ceil( $wp_query->post_count/2 );
  15. $posts = 0;
  16.  
  17. if( have_posts() ) {
  18. ?> <ul class="col1"> <?php
  19. while ( have_posts()) : the_post();
  20.     if ($posts == $end_col){
  21.         ?> </ul>
  22.         <ul class="col2"> <?php
  23.     } elseif($posts == $end_col*2) {
  24.         ?> </ul> <?php
  25.     }?>
  26.    
  27.     <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
  28.     <?php
  29.     $posts++;
  30. endwhile;
  31. }
  32. ?> </ul> <?php
  33. wp_reset_query();
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement