Smart Hero Slider
A responsive Netflix-style WordPress hero slider powered by the TMDB API
by Smart Hero Slider · github.com/chamindu-surge/smart-hero-slider · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/chamindu-surge/smart-hero-slider/archive/refs/heads/main.zipReadme
Smart Hero Slider
A production-ready WordPress plugin that creates a responsive Netflix-style hero movie slider powered by the TMDB API, using SwiperJS as the slider engine.
Features
- Netflix-inspired dark theme with cinematic full-bleed backdrop images
- Powered by The Movie Database (TMDB) v3 API
- SwiperJS slider with touch/swipe/mouse-drag support
- Fully configurable admin settings page (Settings → Smart Hero Slider)
- Transient-based caching — TMDB is never called on every page load
- Responsive breakpoints: 4 slides/desktop → 2/tablet → 1/mobile
- Test API Connection button — validates key without saving
- Refresh Movies button — clears cache and fetches fresh data
- Simple shortcode:
[smart_hero_slider] - Clean uninstall — removes all options and cached data
Requirements
| Requirement | Minimum version |
|---|---|
| WordPress | 5.6 |
| PHP | 7.4 |
| TMDB API key | Free (v3 auth) |
Installation
From ZIP (recommended)
- Download the
smart-hero-slider.zipfile. - In your WordPress admin, go to Plugins → Add New → Upload Plugin.
- Choose the ZIP file and click Install Now.
- Click Activate Plugin.
Manual upload
- Unzip and upload the
smart-hero-slider/folder to/wp-content/plugins/. - Activate from the Plugins menu in WordPress.
Getting a TMDB API Key
- Create a free account at themoviedb.org.
- Go to Settings → API in your account dashboard.
- Click Create and choose Developer for personal / test use.
- Complete the short form and accept the terms.
- Copy the API Key (v3 auth) value — it is a 32-character hex string.
Configuration
- Navigate to Settings → Smart Hero Slider in your WordPress admin.
- Paste your TMDB API Key into the TMDB API Key field.
- Click Test API Connection to verify the key (nothing is saved at this step).
- Adjust the remaining settings to your preference (see table below).
- Click Save Settings.
Settings Reference
| Setting | Options | Default | Notes |
|---|---|---|---|
| TMDB API Key | 32-char hex string | — | Required |
| Movie Source | Popular / Now Playing / Upcoming / Top Rated | Popular | Maps to TMDB endpoint |
| Movie Limit | 5 / 10 / 15 / 20 | 10 | Max slides to fetch |
| Slides Per View | 1 – 5 | 4 | Desktop only; tablet=2, mobile=1 |
| Cache Duration | 30 min / 1h / 6h / 12h / 24h | 1 Hour | WordPress transient expiry |
| Autoplay | On / Off | On | Auto-advances slides |
| Loop | On / Off | On | Wraps from last slide to first |
| Delay | 500 – 30 000 ms | 3000 | Milliseconds between slides |
| Transition Speed | 100 – 5 000 ms | 600 | Slide animation duration |
| Navigation Arrows | On / Off | On | Previous / Next chevrons |
| Pagination Dots | On / Off | On | Clickable dot indicators |
Shortcode Usage
Place the shortcode anywhere WordPress renders content — pages, posts, or widget areas that support shortcodes:
[smart_hero_slider]
No attributes are required. All behaviour is controlled from the settings page.
Caching
The plugin stores TMDB API responses as a WordPress transient (shs_movies_cache).
| Event | Cache behaviour |
|---|---|
| First page load after cache expires | Fetches from TMDB, stores result |
| Subsequent page loads within expiry | Served from transient (no API call) |
| Settings saved | Cache is automatically cleared |
| "Refresh Movies" clicked | Cache cleared, fresh fetch performed |
| Plugin deactivated | Cache cleared |
| Plugin uninstalled | Cache and all options deleted |
Folder Structure
smart-hero-slider/
├── smart-hero-slider.php Plugin bootstrap, constants, loader
├── uninstall.php Removes all data on uninstall
├── README.md This file
├── languages/ Translation-ready (.pot files go here)
├── includes/
│ ├── helpers.php shs_get_setting() / shs_get_all_settings()
│ ├── class-cache.php WordPress Transients API wrapper
│ ├── class-tmdb-api.php TMDB API + AJAX handlers
│ ├── class-settings.php Settings API registration + admin menu
│ └── class-shortcode.php [smart_hero_slider] shortcode
├── admin/
│ ├── settings-page.php Admin settings page HTML template
│ └── admin.js AJAX for Test/Refresh tool buttons
├── public/
│ ├── frontend.php Slider HTML template (included via ob_start)
│ ├── swiper-init.js SwiperJS initialisation (reads data-shs attr)
│ └── style.css Netflix-inspired frontend stylesheet
└── assets/
└── swiper/
├── swiper-bundle.min.js Bundled SwiperJS 11 (local)
└── swiper-bundle.min.css Bundled SwiperJS 11 styles (local)
Security
The plugin follows WordPress security best practices throughout:
- All output is escaped with
esc_html(),esc_attr(),esc_url(), andesc_url_raw() - All settings are sanitized on save via
sanitize_text_field(),sanitize_key(), andabsint()with whitelist validation - AJAX endpoints verify nonces (
check_ajax_referer) and capability (manage_options) on every request - The TMDB API key is stored in the database and never exposed in HTML source
- No inline SQL; no hardcoded credentials
- Direct file access is blocked in every PHP file via
defined('ABSPATH')checks
License
GPL-2.0+ https://www.gnu.org/licenses/gpl-2.0.txt
This plugin is free software. You may redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or any later version.
This plugin uses:
This product uses the TMDB API but is not endorsed or certified by TMDB.