WordPress.org

Forums

GD Star Rating
[Thumbs Mod] Shows The Thumbs Ratings With Different Colors (7 posts)

  1. bhbilbao
    Member
    Posted 1 year ago #

    In render.php(line 810) replace the $rating_text line with:

    //            $rating_text = '<div id="gdsr_thumb_text_'.$comment_id.'_c" class="gdt-size-'.$unit_width.($already_voted ? " voted" : "").($allow_vote ? "" : " inactive").' gdthumbtext">'.$rating_text.'</div>';
    if ($score > 0) {
              $rating_text = '<div id="gdsr_thumb_text_'.$comment_id.'_c" class="text-center verde gdt-size-'.$unit_width.($already_voted ? " voted" : "").($allow_vote ? "" : " inactive").' gdthumbtext">'.$rating_text.'</div>';
     } elseif ($score < 0) {
              $rating_text = '<div id="gdsr_thumb_text_'.$comment_id.'_c" class="text-center rojo gdt-size-'.$unit_width.($already_voted ? " voted" : "").($allow_vote ? "" : " inactive").' gdthumbtext">'.$rating_text.'</div>';
    } else {
              $rating_text = '<div id="gdsr_thumb_text_'.$comment_id.'_c" class="text-center gdt-size-'.$unit_width.($already_voted ? " voted" : "").($allow_vote ? "" : " inactive").' gdthumbtext"></div>';
    }

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

  2. bhbilbao
    Member
    Posted 1 year ago #

    add to the css:

    .gdthumbtext strong {
    font-size: 33px;
    margin-left: 20px;
    }
    
    .verde{
    color: #336600;
    }
    
    .rojo{
    color: #cc3300;
    }
  3. bhbilbao
    Member
    Posted 1 year ago #

    Or a better way in render.php, same line:

    //            $rating_text = '<div id="gdsr_thumb_text_'.$comment_id.'_c" class="gdt-size-'.$unit_width.($already_voted ? " voted" : "").($allow_vote ? "" : " inactive").' gdthumbtext">'.$rating_text.'</div>';
    // if ($score > 0) {
    if ($votes_plus > $votes_minus) {
              $rating_text = '<div id="gdsr_thumb_text_'.$comment_id.'_c" class="text-center verde gdt-size-'.$unit_width.($already_voted ? " voted" : "").($allow_vote ? "" : " inactive").' gdthumbtext">'.$rating_text.'</div>';
    // } elseif ($score < 0) {
    } elseif ($votes_plus < $votes_minus) {
              $rating_text = '<div id="gdsr_thumb_text_'.$comment_id.'_c" class="text-center rojo gdt-size-'.$unit_width.($already_voted ? " voted" : "").($allow_vote ? "" : " inactive").' gdthumbtext">'.$rating_text.'</div>';
    } else {
              $rating_text = '<div id="gdsr_thumb_text_'.$comment_id.'_c" class="text-center gdt-size-'.$unit_width.($already_voted ? " voted" : "").($allow_vote ? "" : " inactive").' gdthumbtext"></div>';
    }
  4. Geoffrey Hale
    Member
    Posted 1 year ago #

    How could this be done from functions.php?

  5. bhbilbao
    Member
    Posted 1 year ago #

    from functions.php?
    If you update the plugin, the code will be overwrite, but you only need to modify 1 line in:
    wp-content\plugins\gd-star-rating\code\t2\render.php
    line810

  6. CAMEO172
    Member
    Posted 1 year ago #

    I have an easier solution : just do this template :

    <div class"left">%CMM_THUMBS_TEXT%</div><span class=" right red thumblock %CMM_CSS_BLOCK%">%THUMB_DOWN% %VOTES_DOWN%</span><span class="green right thumblock %CMM_CSS_BLOCK%">%THUMB_UP% %VOTES_UP% </span>

    and in CSS :

    .red {color:red}
    .green {color:green}

    there is an example here on my site :

  7. bhbilbao
    Member
    Posted 1 year ago #

    Good work CAMEO172!
    More clean and inside template.
    I didnt thought on it because the templates dont support php code.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.