Bạn nào giúp mình xóa Remover schema.org/AggregateRating kk Star Ratings cấu trúc dữ liệu trên tìm kiếm google. Tại làm cho khách, ông ấy không muốn hiển thị cái chấm điểm **** trên google tìm kiếm. Nhưng vẫn muốn trong bài viết có chấm *** được, nhưng khi hiển thị trên tìm kiếm mấy cái đánh giá sẽ không hiển thị thì làm như thế nào? tại cái plugin kk Star Ratings này mặc định nó sẽ có thẻ cấu trúc dữ liệu: AggregateRating hiển thị *** ra ngoài tìm kiếm ý. Có cách nào thêm code vào functions.php của themes để loại bỏ nó đi không? cảm ơn Cảm ơn
Thường ít ai muốn như bạn . Nhưng để xóa nó đi thì vào cái plugin nó xóa thôi bạn. Để xóa bạn truy cập vào hosting wp-content/plugins/kk-star-ratings/index.php Sau đó mở nó lên tìm tới đoạn code sau và xóa no đi là xong: Mã: $snippet = '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">'; $snippet .= ' <div itemprop="name" class="kksr-title">' . $title . '</div>'; $snippet .= $legend; $snippet .= ' <meta itemprop="bestRating" content="'. $best . '"/>'; $snippet .= ' <meta itemprop="worstRating" content="1"/>'; $snippet .= ' <div itemprop="itemReviewed" itemscope itemtype="http://schema.org/CreativeWork">'; $snippet .= ' <!-- Product properties -->'; $snippet .= ' </div>'; $snippet .= '</div>'; Còn nếu bạn muốn không cho nó hiển thị ở trang chủ, page con Chèn code sau vào functions.php của themes nhé: Mã: function my_conditional_script() { if (is_home() || is_category() || is_tag() || is_author()){ global $kkStarRatings_obj; remove_action('wp_enqueue_scripts', array($kkStarRatings_obj, 'js')); remove_action('wp_enqueue_scripts', array($kkStarRatings_obj, 'css')); remove_action('wp_head', array($kkStarRatings_obj, 'css_custom')); } } add_action('wp_head','my_conditional_script',0);