Advertisement
sscovil

WP Sortable Post Index

Nov 5th, 2011
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. <table class="sortable">
  2.  
  3. <tr>
  4. <th class="sorttable_nosort"></th>
  5. <th>Post Title</th>
  6. <th>Post Date</th>
  7. <th>Categories</th>
  8. <th>Tags</th>
  9. </tr>
  10.  
  11. <?php
  12.     query_posts( array(
  13.         'posts_per_page' => -1,
  14.         'orderby' => 'date',
  15.         'order' => 'DESC'
  16.         )
  17.     );
  18.  
  19.     $count = 0; // Used to assign custom keys to cells in the date column
  20.  
  21.     if(have_posts()) : while(have_posts()) : the_post();
  22.  
  23.         $count++;
  24. ?>
  25.  
  26.     <tr>
  27.     <td><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( array(50,50) ); ?></a></td>
  28.     <td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td>
  29.     <td sorttable_customkey="<?php echo $count; ?>"><?php the_date(); ?></td>
  30.     <td><?php the_category(', '); ?></td>
  31.     <td><?php the_tags('', ', '); ?></td>
  32.     </tr>
  33.  
  34. <?php endwhile; endif; ?>
  35.  
  36. </table>
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement