代码拉取完成,页面将自动刷新
<div id="reviews" class="clearfix">
<?php if(rehub_option('rehub_widget_comments') && comments_open()) : ?><?php echo htmlspecialchars_decode( stripslashes(rehub_kses(rehub_option('rehub_widget_comments')))); ?><div style="margin-bottom:15px; clear:both"></div><?php endif; ?>
<?php if(rehub_option('rehub_disable_comments') != '1') :?>
<div class="reviews">
<?php
echo "<div class='title_reviews'>";
echo "Product Reviews";
echo "</div>";
?>
<div class='sort-buttons-wrapper'>
<a class='sort-button' id='sort-default' style='color:black'>Default</a>
<a class='sort-button' id='sort-helpful' style='color:black'>Most Helpful</a>
<a class='sort-button' id='show-negative' style='color:black'>Only Negative</a>
<a class='sort-button' id='show-positive' style='color:black'>Only Postive</a>
</div>
<?php
?>
<?php if ((rehub_option('type_user_review') == 'full_review' || rehub_option('type_user_review') == 'user') && vp_metabox('rehub_post.rehub_framework_post_type') == 'review' && get_comments_number() > 1) :?>
<div id="rehub-comments-tabs" data-postid = "<?php echo get_the_ID();?>">
<span data-tabID="1" class="active"><?php _e('Show all', 'rehub_framework'); ?></span>
<?php if (rehub_option('enable_btn_userreview') == '1') :?><span data-tabID="2"><?php _e('Most Helpful', 'rehub_framework'); ?></span><?php endif ;?>
<span data-tabID="3"><?php _e('Highest Rating', 'rehub_framework'); ?></span>
<span data-tabID="4"><?php _e('Lowest Rating', 'rehub_framework'); ?></span>
<a href="#respond" class="rehub_scroll add_user_review_link def_btn"><?php _e("Add your review", "rehub_framework"); ?></a>
</div>
<?php endif ;?>
<div id="tab-1">
<ol class="reviewslist">
<?php
$comments_v = get_comments(array(
'post_id' => get_the_ID(),
'status' => 'approve',
'orderby' => 'comment_date',
'order' => 'DESC',
));
wp_list_comments(array(
'avatar_size' => 50,
'max_depth' => 4,
'style' => 'ul',
'callback' => 'rehub_framework_comments',
'reverse_top_level' => (get_option('comment_order')==='asc' ? 1 : 0),
), $comments_v);
unset($comments_v);
?>
</ol>
<div id='comments_pagination'>
<?php paginate_comments_links(array('prev_text' => '«', 'next_text' => '»')); ?>
</div>
</div>
<ol id="loadcomment-list" class="commentlist">
</ol>
<?php
$custom_comment_field = '<textarea id="comment" name="comment" cols="30" rows="10" aria-required="true"></textarea>';
$commenter = wp_get_current_commenter();
/*comment_form(array(
'comment_field' => $custom_comment_field,
'comment_notes_after' => '',
'logged_in_as' => '',
'comment_notes_before' => '',
'title_reply' => __('Leave a reply', 'rehub_framework'),
'cancel_reply_link' => __('Cancel reply', 'rehub_framework'),
'label_submit' => __('Post comment', 'rehub_framework'),
'fields' => apply_filters( 'comment_form_default_fields', array(
'author' =>
'<div class="usr_re"><input id="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .'" name="author" placeholder="'.__('Name', 'rehub_framework').'"></div>',
'email' =>
'<div class="email_re"><input id="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) .'" name="email" placeholder="'.__('E-mail', 'rehub_framework').'"></div>',
'url' =>
'<div class="site_re end"><input id="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) .'" name="url" placeholder="'.__('Website', 'rehub_framework').'"></div><div class="clearfix"></div>',
)
),
));*/
?>
</div> <!-- end comments div -->
<?php endif;?>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
var default_sort = function(a, b) {
var id_a = parseInt(jQuery(a).attr('id').split('-')[1]);
var id_b = parseInt(jQuery(b).attr('id').split('-')[1]);
return id_a > id_b ? 1 : -1;
}
var helpful_sort = function(a, b) {
var helpful_a = parseInt(jQuery(a).find('.help_up_count').text());
var helpful_b = parseInt(jQuery(b).find('.help_up_count').text());
return helpful_a > helpful_b ? -1 : 1;
}
jQuery('#sort-default').click(function(){
var sortEle = jQuery('.reviewslist>li').sort(default_sort);
var reviewslist = jQuery('.reviewslist');
reviewslist.empty().hide();
reviewslist.append(sortEle);
jQuery('.reviewslist>li').show();
reviewslist.fadeIn(1500);
});
jQuery('#sort-helpful').click(function(){
var sortEle = jQuery('.reviewslist>li').sort(helpful_sort);
var reviewslist = jQuery('.reviewslist');
reviewslist.empty().hide();
reviewslist.append(sortEle);
jQuery('.reviewslist>li').show();
reviewslist.fadeIn(1500);
});
jQuery('#show-positive').click(function(){
var reviews = jQuery('.reviewslist>li');
for (var i=0; i<reviews.length; i++){
var review = jQuery(reviews[i]);
var rating = parseInt(review.find('#rating-info').attr('rating'))
if (rating >= 50)
review.addClass('to-show');
else
review.addClass('to-hide');
}
jQuery('.to-hide').hide(0, function(){
jQuery('.to-show').show(0, function(){
for (var i=0; i<reviews.length; i++){
var review = jQuery(reviews[i]);
review.removeClass('to-hide');
review.removeClass('to-show');
}
});
});
});
jQuery('#show-negative').click(function(){
var reviews = jQuery('.reviewslist>li');
for (var i=0; i<reviews.length; i++){
var review = jQuery(reviews[i]);
var rating = parseInt(review.find('#rating-info').attr('rating'))
if (rating >= 50)
review.addClass('to-hide');
else
review.addClass('to-show');
}
jQuery('.to-hide').hide(0, function(){
jQuery('.to-show').show(0, function(){
for (var i=0; i<reviews.length; i++){
var review = jQuery(reviews[i]);
review.removeClass('to-hide');
review.removeClass('to-show');
}
});
});
});
jQuery('.sort-button').attr('href', 'javascript:void(0)');
jQuery('.sort-button').removeAttr('style');
});
</script>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。