SP Gallery
A flexible gallery plugin for showcasing products and portfolios with tabs, sliders, and lightbox.
by Kyrylo Sanchenko · github.com/sanchenkowork/spgallery · 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/sanchenkowork/spgallery/archive/refs/heads/main.zipA WordPress plugin for showcasing products and portfolio projects as interactive galleries with tabs, sliders, and lightbox.
Demo
Live Demo: https://mebzone.com.ua/en/home/
Features
- Two custom post types — Products (
spg_catalog) and Projects (spg_project) - Hierarchical taxonomies — separate category trees for products and projects
- Tab navigation — dynamic subcategory filtering on product archive pages
- Swiper.js sliders — touch-enabled project gallery sliders with prev/next controls
- Lightbox viewer — full-size image preview via Lightbox2 (can be disabled)
- Admin dashboard — stats overview with quick links to add/view content
- Gallery metabox — drag-and-select image gallery manager on project edit screens
- Conditional asset loading — lightbox scripts only load when the feature is enabled
- Fully translatable — all strings use WordPress i18n functions (text domain:
spgallery) - Secure — nonce verification, capability checks, input sanitization, output escaping throughout
Requirements
| Requirement | Version |
|---|---|
| WordPress | 5.8 or higher |
| PHP | 7.4 or higher |
| MySQL | 5.6 or higher |
Installation
- Clone or download the repository into your plugins directory:
git clone https://github.com/kyrylsanchenko/sp-gallery.git wp-content/plugins/spgallery - Activate the plugin from Plugins → Installed Plugins in the WordPress admin.
- Rewrite rules are flushed automatically on activation — no need to visit Permalinks settings.
- Navigate to SP Gallery in the admin sidebar to manage content.
Usage
Products (Catalog)
Products are displayed automatically on their taxonomy archive pages — no shortcode needed.
- Go to SP Gallery → SPG Products → Add New
- Set a featured image or upload images via the gallery metabox
- Assign the product to a category
- Publish — it appears automatically on the category archive page with tab navigation
Projects (Portfolio)
Projects are displayed via a shortcode or automatically on taxonomy archive pages.
- Go to SP Gallery → SPG Projects → Add New
- Upload images via the Project Gallery metabox
- Assign the project to a category
- Publish — use the shortcode below to embed the portfolio anywhere
Shortcode: [portfolio_gallery]
[portfolio_gallery]
Displays all published projects grouped by category.
[portfolio_gallery category="web-design"]
Filters output to a single category by slug. Accepts a comma-separated list of slugs.
[portfolio_gallery limit="12"]
Limits the total number of projects queried.
[portfolio_gallery posts_per_category="3"]
Limits how many projects appear per category group.
[portfolio_gallery show_category_link="false"]
Hides the "More projects" link below each category block.
All attributes combined:
[portfolio_gallery category="web-design,branding" limit="20" posts_per_category="4" show_category_link="true"]
Settings
Go to SP Gallery → Dashboard in the WordPress admin.
| Option | Description |
|---|---|
| Enable Lightbox | Enables full-size image preview when clicking gallery images. When disabled, lightbox assets are not loaded. |
Project Structure
spgallery/
├── assets/
│ ├── css/
│ │ ├── admin/ # Admin dashboard styles
│ │ └── frontend/ # Frontend gallery styles (SCSS + compiled CSS)
│ ├── js/
│ │ ├── spg-admin.js # Media library integration for gallery metabox
│ │ └── spg-main.js # Frontend tabs, Swiper sliders, lightbox init
│ └── vendors/
│ ├── lightbox2/ # Lightbox2 library
│ └── swiper/ # Swiper.js library
├── includes/
│ ├── admin/ # Settings page, gallery metabox
│ ├── catalog/ # Product renderer, catalog security
│ ├── core/ # Plugin bootstrap, asset manager, template loader
│ ├── cpt/ # Custom post type and taxonomy registration
│ └── projects/ # Portfolio renderer, shortcode handler
├── languages/ # Translation files (.po / .mo)
├── templates/
│ ├── product/ # Archive template for product categories
│ └── project/ # Archive template for project categories
├── uninstall.php # Cleanup on plugin deletion
└── spgallery.php # Plugin entry point
Localization
All user-facing strings are translatable. Translation files (.po / .mo) live in /languages.
To contribute a translation:
- Open
/languages/spgallery.potin Poedit or Loco Translate - Translate strings and export
.po+.mofiles - Name the files using the locale code, e.g.
spgallery-de_DE.po
Currently included: English (default), Ukrainian (uk_UA), Russian (ru_RU)
Security
- All form submissions verified with WordPress nonces
- All user input sanitized (
sanitize_text_field,absint,wp_unslash) - All output escaped (
esc_html,esc_attr,esc_url,wp_kses_post) - Capability checks on every admin action (
manage_options,edit_post) - Attachment IDs validated with
wp_attachment_is_image()before saving - Plugin data fully removed on uninstall via
uninstall.php
License
MIT — free to use, modify, and distribute.
Author
Kyrylo Sanchenko sanchenko.top