Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8593257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:56:51+00:00 2026-06-11T23:56:51+00:00

I have posted this up in various forums, but no luck so far (hope

  • 0

I have posted this up in various forums, but no luck so far (hope its ok to post it here also?)…I have been trying for a few weeks…no success.

I have two pages on my blog (top rated and most viewed) which return a column of posts (with titles/thumbs), but at the top of these column’s I would like to “filter” these posts into week/month/all time. (Since I followed a tutorial, I wanted to keep it the same, so I will change the sorting options from date etc later).

The following code is mean refresh the page and load the new url like example.com/top-rated/?o=title-asc. But so far it displays the popular posts and the drop down menu with options…when I click nothing actually happens.

I have piggybacked my site on a friends domain, if anybody could take a look at let me know what you think…it would appreciated.

Thanks in advance folks 🙂

Here is my code:

<?php
/*
 * Template Name: Top Rated
*/
get_header();  ?>

<?php
if( isset($_GET['o']) && $_GET['o'] != '')
          {
              $order = $_GET['o'];
              switch($order)
              {
                case 'date-asc': $orderby = 'order=ASC';
                            $msg = 'Date Ascending';
                              break;

                case 'date-desc': $orderby = 'order=DESC';
                            $msg = 'Date Descending(default)';
                              break;

                case 'date-mod': $orderby = 'orderby=modified';
                                $msg = 'Date Modified';
                               break;

                case 'title-asc': $orderby = 'orderby=title&order=ASC';
                                $msg = 'Title A-Z';
                                break;

                case 'title-desc': $orderby = 'orderby=title&order=DESC';
                                $msg = 'Title Z-A';
                                break;

                case 'comment': $orderby = 'orderby=comment_count';
                                $msg = 'Comment Count';
                                break;
              }
          }
          else
          {
              $orderby = 'order=DESC';
              $msg = 'Date Descending (default)';
          }
?>
<div id="content">
    <div id="sorter-container">
        <script type="text/javascript">
                var orderby = jQuery('#order-by');
                var str;
                orderby.change(function(){
                    str = jQuery(this).val();
                     window.location.href = "<?php echo home_url(); ?>/top-rated/?o="+str;
                });
            </script>
<h2 id="sort-heading">Posts ordered by:<?php echo $msg; ?></h2>
        <select id="order-by">
            <option value="date-desc" <?php echo (!isset($order) || $order == '' || $order == 'date-desc')? 'selected="selected"':''; ?>>Date Desc. (default)</option>
            <option value="date-asc" <?php echo ($order == 'date-asc')? 'selected="selected"':''; ?>>Date Asc</option>
            <option value="date-mod" <?php echo ($order == 'date-mod')? 'selected="selected"':''; ?>>Date Modified</option>
            <option value="title-desc" <?php echo ($order == 'title-desc')? 'selected="selected"':''; ?>>Title Desc.</option>
            <option value="title-asc" <?php echo ($order == 'title-asc')? 'selected="selected"':''; ?>>Title Asc.</option>
            <option value="comment" <?php echo ($order == 'comment')? 'selected="selected"':''; ?>>Comments Count</option>
        </select>
    </div>
<?php query_posts('meta_key=votes_count&orderby=meta_value_num&order=DESC&posts_per_page=10'); ?>
    <?php if ( have_posts() ){ ?>
    <?php  while ( have_posts() ) : the_post() ?>
    <div <?php echo post_class(); ?>>
        <h3> <a href="<?php the_permalink(); ?>"class="img_hover_trans"><?php the_post_thumbnail('featured-small'); ?></a>
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> | <small><?php the_time('F jS, Y'); ?></small></h3>
         <?php the_excerpt('Read more...'); ?>
    </div>
    <?php endwhile; ?>
<?php } ?>
</div>
<?php
get_sidebar();
get_footer();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:56:52+00:00Added an answer on June 11, 2026 at 11:56 pm

    Turns out I had some code in the wrong place (sorry, Im new to this)…so finally spotted it after Kemal posted up some code to try. So thanks for the help/support, I will update the OP with the new working code, it should work by copying and pasting into your project. If so, pay close attention to this part window.location.href = "<?php echo home_url(); ?>/top-rated/?o="+str; replace top-rated with your page-slug. If anybody figures out how to sort by week/month/alltime, please post up here (As it would be helpful)
    `

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried various link posted on SO,but not got reliable answer. Here is
I have posted a bit here related to a project I have been trying
[I have posted this at the Django users | Google Groups also.] Using the
This sounds like a problem many others have posted about, but there's a nuance
I have already posted a question about this, but the situation has changed sufficiently
im sorry if this was posted already i have been looking to no avail..
I posted a thread about this earlier and have made some progress but now
I'm asking this question because I have gone through the tutorial posted here: Preventing
This should be really simple, but I have tried many solutions posted on the
I have posted this to ServerFault, but the Node.js community seems tiny there, so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.