This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

sidebar

By: a guest on Sep 7th, 2012  |  syntax: PHP  |  size: 1.31 KB  |  views: 153  |  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. <div id="sidebar">
  2. <h3>Archive</h3>
  3.  
  4. <h4>Latest Articles:</h4>
  5.  
  6. <?php query_posts('orderby=title&order=asc&showposts=5'); ?>
  7. <?php if (have_posts()) : ?>
  8. <?php while (have_posts()) : the_post(); ?>
  9. <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Link for <?php the_title(); ?>"><?php the_title(); ?></a></li>
  10. <?php endwhile; ?>
  11. <?php endif; ?>
  12.  
  13. <h4 class="title-dropdown">Articles by date:</h4>
  14.  
  15. <select name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
  16.   <option value=""><?php echo esc_attr( __( 'Select Month' ) ); ?></option>
  17.   <?php wp_get_archives( 'type=monthly&format=option&show_post_count=1' ); ?>
  18. </select>
  19.  
  20. <h4 class="title-dropdown">Articles by category:</h4>
  21.  
  22.         <?php wp_dropdown_categories('show_option_none=Select Category'); ?>
  23.  
  24. <script type="text/javascript"><!--
  25.     var dropdown = document.getElementById("cat");
  26.     function onCatChange() {
  27.                 if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
  28.                         location.href = "<?php echo get_option('home');
  29. ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
  30.                 }
  31.     }
  32.     dropdown.onchange = onCatChange;
  33. --></script>
  34.  
  35.  
  36. <?php if ( is_single() ) { ?>
  37.      <p>Show this just when a single post is displayed</p>
  38. <?php } ?>
  39.  
  40.  
  41.         <div class="clear-both"></div>
  42.  
  43.  
  44.        
  45. </div>
clone this paste RAW Paste Data