0
A
回答
0
Woocommerce已经显示评论数旁边星级单品页。但在商店和档案页面上,它只显示星级评分。即使在商店和档案页面上,按照以下步骤显示星级评分。
步骤1)创建你的主题的根一个新的文件夹并将其命名为“woocommerce”
步骤2)在新创建的“woocommerce”文件夹并将其命名为“环”
创建一个新的文件夹步骤3)添加“rating.php”文件到新创建的“回路”文件夹
现在你的目录会是这个样子
/的public_html /可湿性粉剂内容/主题/你的主题/ woocommerce /循环
下面的代码添加到新创建的“rating.php”,并根据您的需要进行定制。
<?php
/**
* Loop Rating
*
* This template can be overridden by copying it to yourtheme/woocommerce/loop/rating.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 3.0.0
*/
if (! defined('ABSPATH')) {
exit;
}
global $product;
if (get_option('woocommerce_enable_review_rating') === 'no') {
return;
}
$rating_count = $product->get_rating_count();
$review_count = $product->get_review_count();
$average = $product->get_average_rating();
if ($rating_count >= 0) : ?>
<?php echo wc_get_rating_html($average, $rating_count); ?>
<?php if (comments_open()): ?><a href="<?php echo get_permalink() ?>#reviews" class="woocommerce-review-link" rel="nofollow">(<?php printf(_n('%s',$review_count,'woocommerce'), '<span class="count">' . esc_html($review_count) . '</span>'); ?>)</a><?php endif ?>
<?php endif; ?>
在这种情况下,不“woocommerce”文件夹工作
添加“模板”文件夹,然后在“模板”文件夹中添加“回路”文件夹中。
现在的目录应该是这样
/的public_html /可湿性粉剂内容/主题/你的主题/ woocommerce /模板/循环
相关问题
- 1. 循环显示星级评分
- 2. 显示评分以前评论
- 3. JavaScript - 显示保存的评论名称和评论显示在彼此的旁边,而不是顶部?
- 4. 根据子分评论根据子分评论显示
- 5. WooCommerce将“SSSSS”基于文本的评分改为默认星级评分
- 6. 星级评分系统
- 7. 星级评分系统
- 8. Laravel - 星级评分 - 优化?
- 9. 星级评分系统html
- 10. 星级评分系统(jQuery)
- 11. 单星级评分条码
- 12. 如何在文本标签旁边放置星级评分图片
- 13. 在Facebook上只显示朋友的评论社交评论插件fb:评论
- 14. 锚链接到WooCommerce评论
- 15. 不显示生产的星级评分(heroku)
- 16. 边界评论框
- 17. 评论部分突出显示(Atom)
- 18. 在循环中获取WooCommerce星级评分
- 19. 星级评分系统,给出唯一的评分
- 20. 评论fb button,评分
- 21. 在UITableView中显示评论
- 22. 隐藏并显示评论
- 23. 显示评论和回复?
- 24. JavaScript-如何在AngularJS中动态显示只读星级评分?
- 25. 星级评分错误呈现jquery星级评分小工具和分裂星星
- 26. Facebook的评论模块不会在桌面上显示评论
- 27. 评论插件 - 仅显示最近x天的评论
- 28. PHP - 评级1-5星级
- 29. Twitter Bootstrap rtl评级星级
- 30. 星级评分,执行威尔逊评分区间