wordpress 分级显示数字而不是星级

lvjbypge  于 2023-01-04  发布在  WordPress
关注(0)|答案(2)|浏览(236)

I don't know why my website's Schema.org markup is showing number and characters instead of stars.
例如,它显示"3/5"而不是"***"。

我该怎么修呢?
我正在使用WordPress和所有在一个架构丰富的代码段插件。

mtb9vblg

mtb9vblg1#

遭受了同样的问题。最后经过大量的搜索和尝试,我想出了这个解决方案。
这将获取显示评级的模板。但它显示如下:第一个月

<div class="rating-custom">
    <?php wc_get_template( 'single-product/rating.php' ); ?>
</div>

然后将此css代码粘贴到自定义css中。

/*star rating for products*/
.rating-custom div.product .woocommerce-product-rating {
    margin-bottom: 1.618em;
}

.rating-custom .woocommerce-product-rating .star-rating {
    margin: .5em 4px 0 0;
    float: left;
}

.rating-custom .woocommerce-product-rating::after, .rating-custom .woocommerce-product-rating::before {

    content: ' ';
    display: table;

}

.rating-custom .woocommerce-product-rating {
    line-height: 2;
}

.rating-custom .star-rating {
    float: right;
    overflow: hidden;
    position: relative;
    height: 1em;
    line-height: 1;
    font-size: 1em;
    width: 5.4em;
    font-family: star;
}

.rating-custom .star-rating::before {
    content: '\73\73\73\73\73';
    color: #d3ced2;
    float: left;
    top: 0;
    left: 0;
    position: absolute;
}

.rating-custom .star-rating {
    line-height: 1;
    font-size: 1em;
    font-family: star;
}

.rating-custom .star-rating span {
    overflow: hidden;
    float: left;
    top: 0;
    left: 0;
    position: absolute;
    padding-top: 1.5em;
}

.rating-custom .star-rating span::before {
    content: '\53\53\53\53\53';
    top: 0;
    position: absolute;
    left: 0;
}

.rating-custom .star-rating span {

    overflow: hidden;
    float: left;
    top: 0;
    left: 0;
    position: absolute;
    padding-top: 1.5em;

}

输出:

q3qa4bjr

q3qa4bjr2#

我正在使用Elementor页面生成器,我遇到了同样的问题。原来,当你试图在WooCommerce单一产品页面以外的页面上显示星星时,问题就出现了。
解:赋值class="woocommerce"
添加到您用来放置星星的elementor小部件中,它可以是shortcode小部件、html、文本编辑器或您正在尝试使用elementor执行的任何疯狂操作

相关问题