Panth Hero Slider for Magento 2
A free Magento 2 homepage hero carousel. By default three slides show on desktop with the centre slide in focus, and one slide shows on phones. Each slide has its own CTA button, and views and clicks are counted per slide, on Hyvä and Luma.
- Free
composer require mage2kishan/module-hero-slider
- Package requirementsRead the source documentation
- Developer profileView Upwork profile
- Themes listedCheck the selected release
- PHP versions listedCheck the selected release
- Installation questionsDiscuss your store setup
What it does for your store
The main features, as listed in the module documentation.
-
Centre focus carousel
Three slides per page on desktop by default, with the active slide in the centre and its neighbours on each side.
-
One slide on phones
Below the mobile breakpoint, 1025 px by default, the carousel shows one slide with pagination dots and no arrows.
-
CTA button per slide
Each slide has a link, a button label, a background colour and a text colour.
-
Desktop and mobile artwork
A picture element serves the mobile image up to 767 px wide and falls back to the desktop image.
-
Views and clicks
Counts per slide, day, store view and device type, shown as 30 day views, clicks and CTR in the admin.
-
On the home page by default
Adds the homepage_hero slider to the CMS home page. Use the widget or layout XML for other pages.
Installation
Example commands from the Magento root. Follow the package instructions and your staging and deployment process.
- 1Check the releaseMatch Magento, PHP, theme and dependency requirements.
- 2Install on stagingReview Composer changes and follow the package instructions.
- 3Configure and verifyUse the documented settings and test the affected features.
$ composer require mage2kishan/module-hero-slider $ bin/magento setup:upgrade $ bin/magento setup:di:compile $ bin/magento setup:static-content:deploy -f $ bin/magento cache:clean
Listed requirements
These are the details supplied in this listing. Confirm the selected release supports your Magento edition, PHP and storefront.
| Composer package | mage2kishan/module-hero-slider |
|---|
Documentation
Product details and setup guidance. Check the package repository for release-specific instructions.
A homepage hero carousel with its own analytics
Hero Slider adds a centre focus image carousel to a Magento 2 storefront. Slides are grouped into sliders. Each slider has an identifier and one or more store views, and each slide has a desktop image, an optional mobile image, a link and a call to action button with its own colours.
On install, a data patch creates a "Home Page Hero" slider with the identifier homepage_hero for all store views, and the module adds it to the top of the CMS home page content. Once one active slide is assigned to it, the carousel appears. Switch off "Auto-inject on CMS Home Page" to place it yourself with the Panth Hero Slider widget or a block in layout XML.
Layout
The carousel runs on Splide.js 4.1.4, which is bundled with the module and served from your own static files, so no CDN is contacted. On desktop it shows three slides per page by default with the active slide in the centre. Below the mobile breakpoint, 1025 px by default, it shows one slide with pagination dots. Autoplay is on with a 22 second interval. A slider with one slide renders as a static image without controls.
Controls include a labelled pause and play button while autoplay runs, 44 px arrows and dots, and the left and right arrow keys while the carousel has focus. Autoplay pauses on hover and focus, and stays paused for visitors who prefer reduced motion.
Images and markup
A picture element serves the mobile image up to 767 px wide and the desktop image above that. The first slide image loads eagerly with fetchpriority="high", later slides lazy-load, and the module prints a JSON-LD ItemList of the slide images. The template brings its own CSS and does not depend on theme JavaScript.
Views and clicks
Each slide view and click is sent with navigator.sendBeacon to a POST endpoint that checks the storefront form key and limits requests per IP address. Counts are stored per slide, day, store view, event type and device type. The statistics table stores no IP address or customer data; the rate limit keeps a hashed IP key in the cache for about two minutes. The slides grid shows views, clicks and CTR for 30 days, and each slide edit page has a Performance panel with 30 day and 7 day totals, a by device table and a daily trend. A daily cron job deletes statistics older than 365 days by default.
Settings
Stores > Configuration > Panth Infotech > Hero Slider has the master switch, autoplay and its interval, slides per page, desktop arrows, the mobile breakpoint, home page injection, tracking, retention and the per IP limit. Sliders and slides are managed under Panth Infotech > Hero Slider.
Requirements
- Magento Open Source or Adobe Commerce 2.4.4 to 2.4.8.
- PHP 8.1, 8.2, 8.3 or 8.4.
- mage2kishan/module-core 1.0.17 or later in the 1.x line, installed by Composer.
- Magento cron, for pruning old statistics.
Free and open source under the MIT License.
Developer notes
- Module
Panth_HeroSlider, PHP namespacePanth\HeroSlider. It loads afterMagento_Backend,Magento_Cms,Magento_Store,Magento_UiandPanth_Core. Frontend and admin front name:panth_heroslider. - Service contracts:
Api\SliderRepositoryInterface(save, getById, getByIdentifier, delete, deleteById),Api\SlideRepositoryInterface(save, getById, delete, deleteById),Api\Data\SliderInterfaceandApi\Data\SlideInterface. Nowebapi.xmlis shipped. Model\StatTrackerhastrack(),getTotals(),getDeviceBreakdown(),getTimeline()andpruneOlderThan().Model\TrackGuarddrops a repeat of the same slide and event within one session.- Uploaded images use the temporary path
panth/heroslider/tmp/slideand the final pathpanth/heroslider/slide. - ACL resources:
Panth_HeroSlider::sliders,Panth_HeroSlider::slider_save,Panth_HeroSlider::slider_delete,Panth_HeroSlider::slides,Panth_HeroSlider::slide_save,Panth_HeroSlider::slide_deleteandPanth_HeroSlider::config. - Database tables:
panth_hero_slider_slider,panth_hero_slider_slider_store(cascade delete),panth_hero_slider_slide(slider_id set to NULL when its slider is deleted) andpanth_hero_slider_stat(cascade delete with its slide). - No plugins, observers or console commands are declared.
Questions before you install?
Send me your composer.json and I will check for conflicts first. Free. Installation is +$45, custom work is quoted first.