Advertisement
toxiccosmos

count index minus working nav

Jan 21st, 2014
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.55 KB | None | 0 0
  1.             <?php $count = 0;
  2.                 // The Query
  3.                 $the_query = new WP_Query( array( 'posts_per_page'=> 5 ) );
  4.             ?>
  5.            
  6.             <?php if ( $the_query->have_posts() ) : ?>
  7.            
  8.             <div id="main_navigation_top">
  9.                 <?php wp_pagenavi(); ?>
  10.             </div>
  11.            
  12.             <?php   // The Loop
  13.                 while ( $the_query->have_posts() ) : $the_query->the_post();
  14.                 $count++;
  15.             ?>
  16.            
  17.             <?php if ( $count == 1 ) : ?>
  18.            
  19.                 <div id="featured">
  20.                     <div id="post_header">
  21.                         <span id="date">
  22.                             <span id="top">
  23.                                 <p>
  24.                                 <span id="month"><?php the_time('M') ?></span>
  25.                                 <span id="day"><?php the_time('j') ?></span>
  26.                                 <span id="year"><?php the_time('Y') ?></span>
  27.                                 </p>
  28.                             </span>
  29.                             <span id="bottom">
  30.                                 <p>
  31.                                 <span id="day_name"><?php the_time('l') ?></span>
  32.                                 </p>
  33.                             </span>
  34.                         </span>
  35.                         <span id="title">
  36.                             <h2 id="main_head"><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h2>
  37.                         </span>
  38.                     </div>
  39.                     <span style="clear: both;"></span>
  40.                     <div id="categories">
  41.                         in <?php the_category(', ') ?>
  42.                     </div>
  43.                     <span style="clear: both;"></span>
  44.                     <div id="post">
  45.                         <?php
  46.                             $content = get_the_content();
  47.                             $trimmed_content = wp_trim_words( $content, 300, ' [...]' );
  48.                             echo $trimmed_content;
  49.                             ?>
  50.                     </div>
  51.                     <div id="more">
  52.                         <p><a href="<?php echo get_permalink(); ?>">READ MORE</a></p>
  53.                     </div>
  54.                 </div>     
  55.  
  56.                 <div id="main_posts">
  57.                
  58.             <?php elseif (++$i % 2) : ?>
  59.            
  60.                 <div id="post_left">
  61.                     <div id="post_header">
  62.                     <span id="date">
  63.                         <span id="top">
  64.                             <p>
  65.                             <span id="month"><?php the_time('M') ?></span>
  66.                             <span id="day"><?php the_time('j') ?></span>
  67.                             <span id="year"><?php the_time('Y') ?></span>
  68.                             </p>
  69.                         </span>
  70.                         <span id="bottom">
  71.                             <p>
  72.                             <span id="day_name"><?php the_time('l') ?></span>
  73.                             </p>
  74.                         </span>
  75.                     </span>
  76.                     <span id="title">
  77.                         <h2 id="main_head"><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h2>
  78.                     </span>
  79.                     </div>             
  80.                     <div id="categories">
  81.                         in <?php the_category(', ') ?>
  82.                     </div>
  83.                     <div id="post">
  84.                         <?php
  85.                         $content = get_the_content();
  86.                         $trimmed_content = wp_trim_words( $content, 50, ' [...]' );
  87.                         echo $trimmed_content;
  88.                         ?>
  89.                     </div>
  90.                     <div id="more">
  91.                         <p><a href="<?php echo get_permalink(); ?>">READ MORE</a></p>
  92.                     </div>
  93.                 </div>
  94.                
  95.             <?php else : ?>
  96.                
  97.                 <div id="post_right">          
  98.                     <div id="post_header">
  99.                     <span id="date">
  100.                         <span id="top">
  101.                             <p>
  102.                             <span id="month"><?php the_time('M') ?></span>
  103.                             <span id="day"><?php the_time('j') ?></span>
  104.                             <span id="year"><?php the_time('Y') ?></span>
  105.                             </p>
  106.                         </span>
  107.                         <span id="bottom">
  108.                             <p>
  109.                             <span id="day_name"><?php the_time('l') ?></span>
  110.                             </p>
  111.                         </span>
  112.                     </span>
  113.                     <span id="title">
  114.                         <h2 id="main_head"><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h2>
  115.                     </span>
  116.                     </div>
  117.                
  118.                     <div id="categories">
  119.                         in <?php the_category(', ') ?>
  120.                     </div>
  121.                
  122.                     <div id="post">
  123.                         <?php
  124.                         $content = get_the_content();
  125.                         $trimmed_content = wp_trim_words( $content, 50, ' [...]' );
  126.                         echo $trimmed_content;
  127.                         ?>
  128.                     </div>
  129.                     <div id="more">
  130.                         <p><a href="<?php echo get_permalink(); ?>">READ MORE</a></p>
  131.                     </div>
  132.                 </div>
  133.            
  134.             <?php endif; ?>
  135.             <?php endwhile; ?> 
  136.             <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement