Actually i am trying to add Home Page Slider pro grammatically using js code not extension magento 2?


2 Answers 2


In Magento 2.x you need to Integration of the Block in to CMS

  • Go to the Admin Panel of the Magento Store and navigate to the Content tab from the left corner of the page. Next, click the Blocks option.
  • Add New Block.
  • Add the details of the Block. Enter the Block Title (Title of the Block) and Block Identifier (Id of the Block).

You could add the Block in the content section by using this shortcode:

{{block class="Magento\Cms\Block\Block" block_id="Banner_View"}}

This will help you out.


You don't need to add an extension in Magento 2 to add a simple homepage banner slider.

  1. Create your custom block or widget in your theme
  2. In your template get the data that you need from that widget and instance your js library for the slider. (Owl/Slick/Swiper/whatever you want)
  3. Include your files correctly in your theme/module/web/ folders
  4. Setup upgrade or clean cache & grunt exec/less
  5. Setup your CMS widget in your homepage CMS page and it should be there.

If you are talking about updating your cms structure programmatically you will need to setup an upgradedata on your Block very similar to Magento 1. See: https://www.mageplaza.com/devdocs/magento-2-create-cms-pages-programmatically.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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