WordPress.org

Forums

GD Star Rating
[resolved] Sorting by rating -> title (5 posts)

  1. vvw_soko
    Member
    Posted 2 years ago #

    Hi,

    I'm trying to sort my category pages by rating -> title.
    This because I want to show posts without a rating sorted by title.
    However i cannot get this to work and can't find anything on it in the documentation/topics.

    For making the category sort by rating I altered the query in the following way:
    $query->set( 'gdsr_sort', 'rating' );
    $query->set( 'gdsr_multi', 2 );

    So far I've tried:
    $query->set( 'orderby', 'title');

    and:
    $query->set( 'orderby', 'gdsr_sort title');

    and:
    $query->set( 'gdsr_sort', 'rating title' );

    All without succes, does anyone have an idea on how to do this?

    http://wordpress.org/extend/plugins/gd-star-rating/

  2. soonrise
    Member
    Posted 2 years ago #

  3. vvw_soko
    Member
    Posted 2 years ago #

    Thanks for trying to help, but that is not what I want to do. I want to alter the loop query to show results ordered by rating -> title.

    Like Milan does in this article:
    http://v1.gdstarrating.com/2009/07/03/how-to-reorder-posts/

    But then more advanced.

    Since I need it quick I'll try to fix it in the plug-in myself.

  4. vvw_soko
    Member
    Posted 2 years ago #

    For those interested, having seen the code I'm quite sure there's no option for it. However if you really need it, you can manually change the code:

    file gd-star-rating/code/blg/query.php

    If you have a single rating (standard rating, no multi rating) change line 114, if you have a multi rating change line 174, replace:

    if ($c != "") {
    $c.= sprintf(", %sposts.post_date desc", $table_prefix);
    }

    with:

    if ($c != "") {
    $c.= sprintf(", %sposts.post_title asc", $table_prefix);
    }

  5. vvw_soko
    Member
    Posted 2 years ago #

    Marked as resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic