Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2012
2,305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <?php
  2. $order = "&order=DESC";
  3. if ($_POST['select'] == 'tag') { $order = "&tag=mytag"; }
  4. if ($_POST['select'] == 'title') { $order = "&order=ASC&orderby=title"; }
  5. if ($_POST['select'] == 'newest') { $order = "&order=DESC"; }
  6. if ($_POST['select'] == 'oldest') { $order = "&order=ASC"; }
  7. if ($_POST['select'] == 'mcommented') { $order = "&order=DESC&orderby=comment_count"; }
  8. if ($_POST['select'] == 'lcommented') { $order = "&order=ASC&orderby=comment_count"; }
  9. ?>
  10.  
  11.  
  12. <form method="post" id="order">
  13. Sort reviews by:
  14. <select name="select" onchange='this.form.submit()'>
  15. <option value="tag"<?php selected( $_POST['select'],'tag', 1 ); ?>>Tag</option>
  16. <option value="title"<?php selected( $_POST['select'],'title', 1 ); ?>>Title</option>
  17. <option value="newest"<?php selected( $_POST['select'],'newest', 1 ); ?>>Newest</option>
  18. <option value="oldest"<?php selected( $_POST['select'], 'oldest', 1 ); ?>>Oldest</option>
  19. <option value="mcommented"<?php selected( $_POST['select'],'mcommented', 1 ); ?>>Most commented</option>
  20. <option value="lcommented"<?php selected( $_POST['select'],'lcommented' , 1 ); ?>>least commented</option>
  21. </select>
  22. </form>
  23.  
  24. <?php query_posts($query_string . $order); ?>
  25. <?php if ( have_posts() ) : ?>
  26. <?php while (have_posts()) : the_post(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement