Advertisement
alchymyth

archive loop first post different

May 3rd, 2015
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.10 KB | None | 0 0
  1. <?php // Check if there are any posts to display
  2.                 if ( have_posts() ) : ?>
  3.                 <h1 class="archive-title"><?php single_cat_title( '', true ); ?></h1>
  4.         <?php if ( category_description() ) :  ?>
  5.         <h5 class="slug-line"><?php echo category_description(); ?></h5>
  6.         <?php endif; ?>
  7.         <hr>
  8.  
  9.                     <?php while ( have_posts() ) : the_post(); ?>
  10.                     <?php if( $wp_query->current_post == 0 && !is_paged() ) : //first post in loop// ?> <!--COLUMN 1-->
  11.         <div id="column1">
  12.             <h2 class="section-title">Latest Story</h2>
  13.  
  14.                     <div class="item">
  15.                     <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  16.                     <small><?php the_time('F jS, Y') ?></small>
  17.  
  18.                     <div class="entry">
  19.                     <?php the_content(); ?>
  20.  
  21.                     <p class="postmetadata"><?php _e( 'Posted in' ); ?> <em><?php the_category( ', ' ); ?> on <?php the_time('F jS, Y') ?></em></p>
  22.                     </div>
  23.                     <div class="comments-template">
  24.                         <?php comments_template();?>
  25.                     </div>
  26.                     </div>
  27.         </div><!--column1-->
  28.  
  29.                     <?php else : //other posts in loop// ?>
  30.  
  31.         <div id="column2">
  32.         <h2 class="section-title">More Stories</h2>
  33.  
  34.                 <div class="item article-preview">
  35.                 <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
  36.                 <p class="date-stamp"><?php the_time('F jS, Y') ?></small></p>
  37.                 <?php if ( has_post_thumbnail()) : ?>
  38.  
  39.                         <?php the_post_thumbnail('thumbnail', array('class' => 'articlethumb')); ?>
  40.  
  41.                     <?php endif; ?>
  42.  
  43.                 <div class="entry">
  44.  
  45.                 <?php the_excerpt(); ?>
  46.  
  47.                 <p class="postmetadata"><?php _e( 'Posted in' ); ?> <em><?php the_category( ', ' ); ?> on <?php the_time('F jS, Y') ?></em></p>
  48.                 </div>
  49.                 <div class="comments-template">
  50.                     <?php comments_template();?>
  51.                 </div>
  52.                 </div>
  53.  
  54.                     <?php endif; //ends oter posts in loop// ?>
  55.  
  56.                     <?php endwhile; ?>
  57.  
  58.                     <div class="navigation">
  59.                         <?php posts_nav_link(); ?>
  60.                     </div>
  61.                 <?php else : ?>
  62.             <p>Sorry - no posts found</p>
  63.         <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement