Simple CPT Gallery
Gallery for posts/pages based on Custom Post Types
★ 0stars
0forks
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/ndrew-sh/sha-simple-gallery/archive/refs/heads/main.zipSimple image gallery based on Custom Post Types/Taxonomy and Fancybox
This plugin allow to create simple gallery and output it with shortcode or Gutenber block.
Contents
Installation
Clone this repo or upload and unzip archive to wp-content/plugins directory. Enable plugin.
Usage
- Under admin area, go to CPT Gallery.
- Add Gallery. Each gallery supports number of images per row, thumbnail size (customizable) and gallery name/description display.
- Add Images. Plugin use post Featured image as gallery image. To change images order in gallery, set post date (images ordered by date).
- Use shortcode
[cptgallery id=GALLERY_ID](or copy it from Galleries page) on any page/post. For Gutenberg editor, add gallery block from SHA Plugins group.
Customization
- If you want to add your own thumbnail size, use WP
add_image_size()function. - To override gallery template, copy
public/templates/elements/shortcode.phtmlfrom plugin folder tosha-simple-gallery/shortcode.phtmlin your theme folder.
Filters
sha_sgal_settings
- Override default gallery settings.
$default_settings = array( 'default' => 4, 'variants' => array( '2' => __( '2 images', 'sha-sgal' ), '3' => __( '3 images', 'sha-sgal' ), '4' => __( '4 images', 'sha-sgal' ), '5' => __( '5 images', 'sha-sgal' ), '6' => __( '6 images', 'sha-sgal' ) ), 'default_thumb_size' => 'medium', 'default_full_size' => 'large', 'load_js' => true, 'load_css' => true, 'fancybox_css' => 'https://cdn.jsdelivr.net/npm/@fancyapps/ui@6.0/dist/fancybox/fancybox.css', 'fancybox_js' => 'https://cdn.jsdelivr.net/npm/@fancyapps/ui@6.0/dist/fancybox/fancybox.umd.js' ); default- default amount of pictures per rowvariants- possible amounts of pictures per row inamount => labelformatdefault_thumb_sizeanddefault_full_size- size of the thumbnail and full picture (add your withadd_image_size())load_jsandloac_css- load plugin styles and scripts (you can disable loading if you want to use them in your own files)fancybox_cssandfancybox_js- CDN styles and script for Fancybox Lib
sha_sgal_cpt_labels
- Override labels in
register_post_type().
sha_sgal_cpt_tax_labels
- Override labels in
register_taxonomy().
sha_gallery_block_data
- Override data, sent to Gutenberg block.