How to reorder posts in Graphene Theme?

  • sirtot

    #3579

    I would like to reorder posts on category pages by GDStar rating system, the query_posts they provide is “query_posts(“gdsr_sort=rating”);”.

    Now when placing it like originally said on WordPress Codex I get PageNavi messed up, and I cant navigate from first page, I tried putting it on the Loop.php and on Category.php, both caused the same mess, can anyone who did it already or just a pro help me with that? thanks a lot in advance!!

    Admin

    Syahir Hakim

    #24921

    Try adding this to your child theme’s functions.php file:

    function graphene_alter_the_query( $request ) {
    $dummy_query = new WP_Query(); // the query isn't run if we don't pass any query vars
    $dummy_query->parse_query( $request );

    // this is the actual manipulation; do whatever you need here
    if ( $dummy_query->is_category() )
    $request['gdsr_sort'] = 'rating';

    return $request;
    }
    add_filter( 'request', 'graphene_alter_the_query' );

    sirtot

    #24922

    Thanks a lot man you are awesome, making this free theme and answering questions thank you!!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Do NOT follow this link or you will be banned from the site!