Orderby code not working
-
I want to allow users to order a posts list through a drop-down menu, but I can’t get the following code to work.
<div class="sort"> <select onclick="if (this.value) { document.location = this.value; }"> <option value="" selected="selected">Sort by</option> <option value="<?php echo $short_page_url; ?>?orderby=title&order=ASC">Titles Z-A</option> <option value="<?php echo $short_page_url; ?>?orderby=title&order=DESC">Titles A-Z</option> </select> </div> <?php $posts = get_posts("numberposts=20&cat=30"); foreach ($posts as $post) : setup_postdata($post); ?> CONTENT GOES HERE <?php endforeach; ?>
Any help would be appreciated.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Orderby code not working’ is closed to new replies.