问题描述
我不知道为什么我网站的 Schema.org 标记显示数字和字符而不是星号.
例如,它显示的是5 分之 3"而不是***".
我该如何解决?
我正在使用 WordPress 和多合一架构丰富代码段插件.
遇到同样的问题.最后经过大量的搜索和试验,我想出了这个解决方案.
这将获取显示评级的模板.但它显示如下:Rated 4.50 out of 5 based on 2 customer ratings (2 customer review)
<?php wc_get_template('single-product/rating.php');?>
然后将此 css 代码粘贴到自定义 css 中.
/*产品星级*/.rating-custom div.product .woocommerce-product-rating {底边距:1.618em;}.rating-custom .woocommerce-product-rating .star-rating {边距:.5em 4px 0 0;向左飘浮;}.rating-custom .woocommerce-product-rating::after, .rating-custom .woocommerce-product-rating::before {内容: ' ';显示:表;}.rating-custom .woocommerce-product-rating {行高:2;}.rating-custom .star-rating {浮动:对;溢出:隐藏;位置:相对;高度:1em;行高:1;字体大小:1em;宽度:5.4em;字体系列:明星;}.rating-custom .star-rating::before {内容:'\73\73\73\73\73';颜色:#d3ced2;向左飘浮;顶部:0;左:0;位置:绝对;}.rating-custom .star-rating {行高:1;字体大小:1em;字体系列:明星;}.rating-custom .star-rating 跨度 {溢出:隐藏;向左飘浮;顶部:0;左:0;位置:绝对;填充顶部:1.5em;}.rating-custom .star-rating span::before {内容:'\53\53\53\53\53';顶部:0;位置:绝对;左:0;}.rating-custom .star-rating 跨度 {溢出:隐藏;向左飘浮;顶部:0;左:0;位置:绝对;填充顶部:1.5em;}
输出:
I don't know why my website's Schema.org markup is showing number and characters instead of stars.
For example, it's showing "3 out of 5" instead of "***".
How can I fix it?
I'm using WordPress and All In One Schema Rich Snippets plugin.
Suffered with same problem. Finally after lot of search and trial I came up with this solution.
This gets the template where the rating is displayed from. But it displays like this: Rated 4.50 out of 5 based on 2 customer ratings (2 customer reviews)
<div class="rating-custom">
<?php wc_get_template( 'single-product/rating.php' ); ?>
</div>
Then paste this css code in a custom 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;
}
Output:
这篇关于评分显示的是数字而不是星星的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!