Advertisement
alchymyth

loop

Feb 23rd, 2013
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.65 KB | None | 0 0
  1. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  2. <?php if( $wp_query->current_post == 0 && !is_paged() ) : //first post// ?>
  3.  
  4. <div class="bw-featured clear">
  5. <?php
  6. $parent_cat = array();
  7. $post_cats = get_the_category($post->ID);
  8. foreach( $post_cats as $post_cat ) {
  9. if( $post_cat->parent ) $parent_cat[] = get_category( $post_cat->parent )->slug;
  10. }
  11. ?>
  12.  
  13.   <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
  14.   <center><a href="<?php the_permalink() ?>"><img src="<?php echo $image[0]; ?>" /></a></center>
  15.   <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
  16.   <p class="post-content"><?php if (function_exists('smart_excerpt')) smart_excerpt(get_the_excerpt(), 28); ?> <a href="<?php the_permalink(); ?>">Read More</a></p>
  17. </div><!--end featured-->
  18.  
  19.   <?php else : ?>
  20.  
  21. <?php  if( ($wp_query->current_post == 0 && is_paged()) || ($wp_query->current_post == 1 && !is_paged()) ) { //open the #loop div only after the first post on the first page or direct for the other pages//  ?>
  22. <div id="loop" class="<?php if ($_COOKIE['mode'] == 'grid') echo 'grid'; else echo 'list'; ?> clear">
  23. <?php } ?>
  24.  
  25.   <div <?php post_class('post clear'); ?> id="post_<?php the_ID(); ?>">
  26.     <?php if ( has_post_thumbnail() ) :?>
  27.     <a href="<?php the_permalink() ?>" class="thumb"><?php the_post_thumbnail('thumbnail', array(
  28.                 'alt'   => trim(strip_tags( $post->post_title )),
  29.                 'title' => trim(strip_tags( $post->post_title )),
  30.             )); ?></a>
  31.     <?php endif; ?>
  32.     <h6 class="post_channel"><?php the_category('<a class="post_channel"></a>'); ?></h6>
  33.     <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
  34.     <div class="post-meta">by
  35.         <span class="post-author"><a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>" title="Posts by <?php the_author(); ?>"><?php the_author(); ?></a></span>
  36.         Published
  37.         <span class="post-date"><?php the_time(__('M j, Y')) ?></span>
  38.         |
  39.         <span><?php the_time() ?></span>
  40.         |
  41.         <?php comments_popup_link(__('No Comments'), __('1 Comment'), __('% Comments'), '', __('Comments Closed')); ?> <?php edit_post_link( __( 'Edit entry'), '<em>&bull; </em>'); ?>
  42.     </div>
  43.     <p class="post-content"><?php if (function_exists('smart_excerpt')) smart_excerpt(get_the_excerpt(), 28); ?> <a href="<?php the_permalink(); ?>">Read More</a></p>
  44.   </div>
  45.  
  46. <?php endif; //ends "if( $wp_query->current_post == 0 && !is_paged() )"// ?>
  47.  
  48.   <?php endwhile; ?>
  49. <?php if( $wp_query->post_count > 1 || is_paged() ) } ?>
  50. </div>
  51. <?php } ?>
  52.  
  53. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement