Advertisement
alchymyth

loop

Aug 16th, 2011
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.82 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  
  3. <?php if (have_posts()) { ?>
  4.  
  5. <div id="content">
  6.  
  7.  <?php
  8.     $postCount = 0;
  9.     $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
  10.     query_posts( 'paged=$page&post_per_page=-1&cat=' . get_query_var('cat') );
  11.     while (have_posts()) { the_post();
  12.         if( $postcount == 0 ) {
  13.         //GETS LATEST OR STICKY POST
  14.     ?>
  15.            
  16.     <div id="lead" class="clearfloat">
  17.              
  18.             <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
  19. <?php echo get_post_image (get_the_id(), '', '', '' .get_bloginfo('template_url') .'/scripts/timthumb.php?zc=1&amp;w=260&amp;h=230&amp;src='); ?></a>
  20.    
  21.     <div id="lead-text">
  22.     <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
  23.     <?php the_title(); ?></a> <span class="commentcount"> (<?php comments_popup_link('0', '1', '%'); ?>)</span></h2>
  24.    
  25.    
  26.     <p class="date"><?php the_time('n/d/y'); ?> &bull; </p>
  27.     <?php the_excerpt(); ?>
  28.     </div>
  29.             </div><!--END LEAD/STICKY POST-->
  30.            
  31.        
  32.         <div id="more-posts">
  33.         <h3><?php _e('Recent Posts','Mimbo'); ?></h3>
  34.        
  35.         <?php
  36.         }
  37.         elseif( $postcount > 0 && $postcount <= 30 ) {
  38.         //GETS NEXT FOUR EXCERPTS
  39.         ?>
  40.  
  41. <?php //MAIN EDIT STARTS HERE
  42. if( $postcount > 4 && $postcount <= 7 ) {
  43. //GETS three narrow EXCERPTS, example only
  44.         ?>
  45.            
  46.         <div class="narrow recent-excerpts <?php echo 'narrow-'.$postcount; ?>">
  47.  
  48. <h4><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a> <span class="commentcount">(<?php comments_popup_link('0', '1', '%'); ?>)</span></h4>
  49.  
  50. <p class="date"><?php the_time('n/d/y'); ?> &bull; </p>
  51.             <?php the_excerpt(); ?>
  52.         </div>
  53.  
  54. <?php }
  55. else {
  56. //MAIN EDIT ENDS HERE (there is more edit to close the if/else later)
  57. ?>
  58.            
  59.         <div class="clearfloat recent-excerpts">
  60.             <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
  61. <?php echo get_post_image (get_the_id(), '', '', '' .get_bloginfo('template_url') .'/scripts/timthumb.php?zc=1&amp;w=105&amp;h=85&amp;src='); ?></a>
  62.  
  63. <h4><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a> <span class="commentcount">(<?php comments_popup_link('0', '1', '%'); ?>)</span></h4>
  64.  
  65. <p class="date"><?php the_time('n/d/y'); ?> &bull; </p>
  66.             <?php the_excerpt(); ?>
  67.         </div>
  68.  
  69. <?php //EDIT TO CLOSE THE IF ELSE FROM MAIN EDIT ?>
  70. <?php } ?>
  71. //END OF EDIT
  72.                        
  73. <?php //GETS NEXT HEADLINES
  74.         }
  75.  
  76.  
  77.         else {
  78.             ob_start();
  79.             echo '<li><a href="';
  80.             the_permalink();
  81.             echo '">';
  82.             the_title();
  83.             echo '</a></li>';
  84.             $links[] = ob_get_contents();
  85.             ob_end_clean();        
  86.         }
  87.         $postcount ++;
  88.         }
  89.     }
  90.     else {
  91. ?>
  92.  
  93. <?php } ?>
  94.    
  95.    
  96. <?php
  97.     if(count($links)): ?>
  98.  
  99.      <h3><?php _e('Older Posts','Mimbo'); ?></h3>
  100.      <ul class="headlines"><?php echo join("\n", $links); ?></ul>
  101.            
  102.     <?php endif; ?>
  103.     </div><!--END RECENT/OLDER POSTS-->
  104.    
  105.    
  106.    
  107.     <div id="featured-cats">
  108.     <h3><?php _e('Featured Categories','Mimbo'); ?></h3>
  109.  
  110.         <?php
  111.         $display_categories = get_option('openbook_cats');
  112.         foreach ($display_categories as $category) {
  113.         $showposts = get_option('openbook_featured_posts');
  114.         query_posts("showposts=$showposts&cat=$category");
  115.         ?>
  116.  
  117. <h5><a href="<?php echo get_category_link($category);?>"><?php single_cat_title(); ?>&raquo;</a></h5>
  118.  
  119.         <ul>
  120.         <?php while (have_posts()) : the_post(); ?>
  121.         <li class="clearfloat"><p class="date"><?php the_time('n/d/y'); ?> &bull; </p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
  122.         <?php endwhile; ?>
  123.         </ul>
  124.     <?php } ?>
  125.    
  126. </div><!--END FEATURED CATS-->
  127.  
  128.    
  129. </div><!--END CONTENT-->
  130.  
  131. <?php get_sidebar(); ?>
  132. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement