如何在WooCommerce中更改S&#39的评论评分?

时间:2016-04-05 13:40:15

标签: php css wordpress woocommerce

如何从当前的' S'更改WooCommerce中评论评分的图像?到实际的星图?
经过良好的Google搜索,我已经尝试过这样做:Replace theme ratings with WooCommerce stars
但它不起作用。它只是将S改为小盒子。

当前的CSS:

.woocommerce .star-rating {
    float:right;
    overflow:hidden;
    position:relative;
    height:1em;
    line-height:1;
    font-size:1em;
    width:5.4em;
    font-family: HelveticaNeue-Light, Helvetica Neue Light;
}
.woocommerce .star-rating:before {
    content:"\73\73\73\73\73";
    color:#d3ced2;
    float:left;
    top:0;
    left:0;
    position:absolute;
}
.woocommerce .star-rating span {
    overflow:hidden;
    float:left;
    top:0;
    left:0;
    position:absolute;
    padding-top:1.5em;
}
.woocommerce .star-rating span:before {
    content:"\53\53\53\53\53";
    top:0;
    position:absolute;
    left:0
}

2 个答案:

答案 0 :(得分:4)

在CSS中使用它:

.woocommerce .star-rating span {
   font-family:star;
}

答案 1 :(得分:0)

以我为例,this answer帮助了我。

我在子主题的style.css中添加了下一个代码:

@font-face {
    font-family: 'star';
    src: url('../../plugins/woocommerce/assets/fonts/star.eot');
    src: url('../../plugins/woocommerce/assets/fonts/star.eot?#iefix') format('embedded-opentype'),
        url('../../plugins/woocommerce/assets/fonts/star.woff') format('woff'),
        url('../../plugins/woocommerce/assets/fonts/star.ttf') format('truetype'),
        url('../../plugins/woocommerce/assets/fonts/star.svg#star') format('svg');
    font-weight: normal;
    font-style: normal;
}

完整路径可让您更好地了解发生了什么:

在此处添加代码: /wp-content/themes/gon-child/style.css

字体生存的原始位置: /wp-content/plugins/woocommerce/assets/fonts/