Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Sidebar

By: a guest on Jul 18th, 2013  |  syntax: None  |  size: 1.11 KB  |  views: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <!-- ******* ****** EMPIEZAN SIDEBAR CATEGORIES ***** ***** -->
  2.  
  3. <div id="sidebar-categories">
  4.  
  5. <?php
  6. $current_cat = get_query_var('cat'); // category ID
  7. $args = array('posts_per_page' => 8, 'cat' => $current_cat, 'order' => 'ASC', 'offset' => 3);
  8. $custom_posts = get_posts($args);
  9. foreach($custom_posts as $post) : setup_postdata($post);
  10. endforeach;
  11. ?>
  12.  
  13. <!-- ******** ******* EMPIEZAN SIDEBAR NEWS ***** ******* -->
  14.  
  15. <div id="title-sidebar-categories"><?php printf( __( '%s' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></div>
  16.  
  17. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  18.  
  19. <div id="date-sidebar-categories"><?php the_time('F jS, Y') ?></div>
  20. <div id="title-sidebar-categories"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></div>
  21. <div id="contents-sidebar-categories"><?php echo substr(get_the_excerpt(), 0,66); ?></div>
  22.  
  23. <?php endwhile;?>
  24.  
  25.        
  26. <?php else : ?>
  27.  
  28. <h1>Nothing Found</h1>
  29.  
  30. <?php endif; wp_reset_query(); ?>
  31.  
  32. <!-- ******** ******* TERMINAN SIDEBAR NEWS ***** ******* -->
  33.  
  34. </div>
  35.  
  36. <!-- ******* ****** TERMINAN SIDEBAR CATEGORIES ***** ***** -->