Is there a way to execute this script only on a specific page with a particular body class? For example, if the page has
<body class="category-type-plp">
How can I target my script to work specifically for "category-type-plp"?
plpSpaceRemove: function() {
$(document).ready(function() {
if ($('.bv-tile.bv-inline-rating-outer').length % 4 === 0) {
for (let i = 0; i < ($('.bv-tile.bv-inline-rating-outer').length / 4); i++) {
let remove = true;
$('.bv-tile.bv-inline-rating-outer').slice(i * 4, 4 * (i + 1)).each(function() {
if ($(this).find(".bv-stars-wrap
").length != 0) {
remove = false;
}
});
if (remove) {
$('.bv-tile.bv-inline-rating-outer').slice(i * 4, 4 * (i + 1)).each(function() {
if ($(this).find(".bv-stars-wrap
").length === 0) {
$(this).css("display", "none");
}
});
}
}
}
else {
for (let i = 0; i < ($('.bv-tile.bv-inline-rating-outer').length / 3); i++) {
let remove = true;
$('.bv-tile.bv-inline-rating-outer').slice(i * 3, 3 * (i + 1)).each(function() {
if ($(this).find('.bv-stars-wrap
').length != 0) {
remove = false;
}
});