GD Star Rating插件:更改动态级联样式表

I’m in the midst of creating a page that allows users to vote for one of two competing images. I’ve used the GD Star Rating plug-in for WordPress in the past, but am struggling with altering the output in accordance to my specifications. Ideally I would like to eliminate the thumbs down option, so users will only be presented with the thumbs up option for both of the images. It appears that the CSS style code is created dynamically through PHP. Assuming that this is what it is called. Typically I would merely alter the CSS code and comment out the section that outputs the thumbs down image, but I’m not entirely sure what to do in this case. I’ve tried to comment out the lines that deal with the thumbs down CSS (i.e., gdthumb.gddw), but it doesn’t appear to have an effect. Ideas?

<?php
if (count($thumb_sets) > 0 && count($thumb_sizes)) {
foreach ($thumb_sizes as $size) {
    echo sprintf(".gdt-size-%s.gdthumbtext { line-height: %spx; }
", $size, $size);
    echo sprintf(".gdt-size-%s.gdthumb, .gdt-size-%s.gdthumb a, .gdt-size-%s.gdthumb div { width: %spx; height: %spx; }
", $size, $size, $size, $size, $size);
    echo sprintf(".gdt-size-%s.gdthumb.gddw a, .gdt-size-%s.gdthumb.gddw div { background-position: 0px -%spx !important; }
", $size, $size, $size);
    echo sprintf(".gdt-size-%s.gdthumb.gdup a:hover { background-position: 0px -%spx; }
", $size, 2 * $size);
    echo sprintf(".gdt-size-%s.gdthumb.gddw a:hover { background-position: 0px -%spx !important; }
", $size, 3 * $size);
    foreach ($thumb_sets as $set) {
        $url = ($set["location"] == 1 ? $base_url_local : $base_url_extra)."thumbs/".$set["folder"]."/thumbs".$size.".".$set["type"];
        echo sprintf(".gdt-size-%s.gdthumb a.gdt-%s, .gdt-size-%s.gdthumb div.gdt-%s { background: url('%s') no-repeat; }
", $size, $set["folder"], $size, $set["folder"], $url);
    }
}
}

?>

Related HTML

<div id = "rateA" style="width:285px; float:left">
<div style="display: none">VA:F [1.9.22_1171]</div>
<div class="thumblock "><div id="gdsr_thumb_288_a_up" class="gdt-size-40 gdthumb gdup">
<a id="gdsrX288XupXaX25X40XY" class="gdt-starrating" rel="nofollow"></a></div>
<div id="gdsr_thumb_288_a_loader_up" style="display: none; width: 40px " class="ratingloader loadup">
<div class="loader flower thumb" style="width: 40px; height: 40px;"></div></div>
<div id="gdsr_thumb_288_a_dw" class="gdt-size-40 gdthumb gddw">
<a id="gdsrX288XdwXaX25X40XY" class="gdt-starrating" rel="nofollow"></a></div>
<div id="gdsr_thumb_288_a_loader_dw" style="display: none; width: 40px " class="ratingloader loaddw">
<div class="loader flower thumb" style="width: 40px; height: 40px;"></div></div>
<div class="ratingtext ">
<div id="gdsr_thumb_text_288_a" class="gdt-size-40 gdthumbtext">Rating: <strong>0</strong> (from 0 votes)</div></div><div class="raterclear"></div></div>

Generated CSS

.gdt-size-40.gdthumb, .gdt-size-40.gdthumb a, .gdt-size-40.gdthumb div {
height: 40px;
width: 40px;
}

.gdthumb {
float: left;
position: relative;
}

1个回答



为了删除拇指图像(即Thumbs Up或Thumbs Down),您应该更改render.php文件。 仅仅更改动态创建CSS的PHP文件时,我无法完成此任务。 </ p>
</ div>

展开原文

原文

In order to remove the thumb images (i.e., Thumbs Up or Thumbs Down) you should alter the render.php file. I was unable to accomplish this task when merely changing the PHP file that dynamically creates the CSS.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问