0

We've been able to display Yotpo reviews carousel on the homepage of our Magento store. But I need to display that also on a few specific category pages. I'm not sure where to add the following code so that carousel will display only in specific category pages.

<style>
.yotpo-reviews-carousel {max-width:1300px !important;position:relative !important;margin-left:auto !important;margin-right:auto !important;margin-top:-15px !important}
</style>


<div class="yotpo yotpo-reviews-carousel" data-header-customisation-enabled="1" data-header-customisation-color="#0000AA" data-header-customisation-font-size="18" data-header-customisation-text="Our customers speak...." data-header-customisation-alignment="left" data-background-color="transparent" data-mode="top_rated" data-type="both" data-count="15" data-show-bottomline="1" data-autoplay-enabled="1" data-autoplay-speed="3000" data-show-navigation="1">&nbsp;</div>

1 Answer 1

0

You can do something like that :

<?php 
$currentcategoryId = take from registry;
if(CURRENT_CAGEOGRY_ID == Need To Show) { ?>
<style>
.yotpo-reviews-carousel {max-width:1300px !important;position:relative !important;margin-left:auto !important;margin-right:auto !important;margin-top:-15px !important}
</style>


<div class="yotpo yotpo-reviews-carousel" data-header-customisation-enabled="1" data-header-customisation-color="#0000AA" data-header-customisation-font-size="18" data-header-customisation-text="Our customers speak...." data-header-customisation-alignment="left" data-background-color="transparent" data-mode="top_rated" data-type="both" data-count="15" data-show-bottomline="1" data-autoplay-enabled="1" data-autoplay-speed="3000" data-show-navigation="1">&nbsp;</div>

<?php } ?>
4
  • Thanks Dhiren. Please tell me what is take from registry;? I mean how to get it from registry? Dec 13, 2021 at 4:48
  • Are you put above code in which file? Dec 13, 2021 at 4:53
  • Specific category pages are where I need to show the carousel. Dec 13, 2021 at 5:38
  • I am asking currently where you put the above code? and It will show for all category pages. Dec 13, 2021 at 5:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.