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 7829761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:54:14+00:00 2026-06-02T10:54:14+00:00

I want to make all my posts in each category descend based on its

  • 0

I want to make all my posts in each category descend based on its score(using GD star rating plugin).
I have found out in the plugin site, that I need to add query_posts("gdsr_sort=rating"); in my archive.php file.

So this is how my archive.php looks with query_posts added:

    <?php query_posts("gdsr_sort=rating"); ?>
<?php while (have_posts()) : the_post(); ?>
    <div <?php post_class() ?>><li>
        <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>

        <?php if ( has_post_thumbnail() ) : ?>
            <a href="<?php the_permalink() ?>"><?php the_post_thumbnail(); ?></a>
        <?php endif; ?>

        <?php the_content('Read more...'); ?>
    </li>
    </div>
    <?php endwhile; ?>
        <div class="clear"></div>
    <?php wp_reset_query(); ?>

And it messed things up, so I tried using query_posts('posts_per_page=5');
The good thing is that it is showing 5 articles per page.
The bad thing is that it’s showing the wrong articles. To be precise, no matter which sub-category I go.. the same articles are being displayed which aren’t supposed to be in that sub-category. When you go to next page.. the same articles are being displayed. These articles that are shown everywhere only belong to 1 sub-category.
I should also mention that I have like 10 cateogires and each of them has 2-3 sub-categories..

I’m at a loss here, hope you understood my explanation.

  • 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-02T10:54:16+00:00Added an answer on June 2, 2026 at 10:54 am

    Instead of making a new query you can modify the wordpress query. I don’t know about the plugin you use but I think this should work:

    function change_archive_query( $query ) {
        if ( $query->is_main_query() && $query->is_archive()) {
             $query->set( 'gdsr_sort', 'rating' );
        }
    }
    add_action( 'pre_get_posts', 'change_archive_query' );
    

    You can put that in your functions.php. In archive.php you can remove query_posts

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

Sidebar

Related Questions

I have a form where I want to make all new DOM elements of
I have the following markup, and I want to make the All radio button
So I have: 01.jpg 02.jpg 3.jpg 4.jpg 05.jpg and want to make them all
I want to make sure all getters of the classes in a certain package
So I want to make sure all of my database / network operations are
I want to make sure that all 3 conditions result in the same answer
HI all I want to make one app for iPhone 2.2.* and for version
I want to make one website for all PC, IPhone, Blackberry, Windows Mobile (IE
I want to make a directory and all subfolders and files password protected so
I want to make a generic function in jquery for select all functionality. I

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.