=== List Custom Post with featured image === Contributors: devikas301 Tags: post grid, custom post type, featured image, shortcode, pagination Requires at least: 5.0 Tested up to: 7.0.4 Requires PHP: 7.0 Stable tag: 1.3.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Show any post type as a responsive gallery of featured images and titles, with pagination, anywhere via shortcode. == Description == This plugin creates a responsive gallery of any public post type using a shortcode. Each item shows the featured image (or a placeholder when none is set) and the post title, linked to the post. Pagination is optional. **Features** * Works with posts, pages and any public custom post type * Responsive CSS Grid layout: 4 / 3 / 2 / 1 columns as the screen narrows * Optional pagination that works with pretty and plain permalinks * Placeholder image when a post has no featured image * Templates can be overridden from your theme * No jQuery, no external frameworks == Installation == Use WordPress Add New Plugin feature, searching "List Custom Post with featured image", or download the archive and: 1. Unzip the archive on your computer 2. Upload the `list-custom-post-with-featured-image` directory to the `/wp-content/plugins/` directory 3. Activate the plugin through the 'Plugins' menu in WordPress 4. Use the shortcode to show the post gallery anywhere == Shortcode == `[lcpostlist post_type="post" limit="4" order="ASC" pagination="off"]` Attributes: * `post_type` - any public post type. Default `post`. * `limit` - posts per page, 1 to 100. `-1` means "as many as possible" and resolves to 100. Default `5`. * `order` - `ASC` or `DESC`. Default `DESC`. * `pagination` - `on` or `off`. Default `on`. In a theme file: `` == Frequently Asked Questions == = How do I change the number of columns? = The layout is driven by a CSS custom property. Add this to your theme's Additional CSS: `.lcpfi-post-gallery { --lcpfi-columns: 3; }` You can also change `--lcpfi-gap` and `--lcpfi-ratio` the same way. = How do I change the markup? = Copy any file from the plugin's `templates/` folder into a `lcpfi/` folder in your theme, for example `yourtheme/lcpfi/gallery-item.php`, and edit it there. Your copy survives plugin updates. = The old uppercase shortcode still works? = Yes. `[LCPOSTLIST]` is still registered alongside the new lowercase `[lcpostlist]`. = Why does my gallery show fewer posts than I asked for? = `limit` is capped at 100 per page to protect the site, and `limit="-1"` resolves to that same cap rather than running an unbounded query. Use pagination for larger sets. = How do I show a message when there are no posts? = Nothing is output by default. To show a message: `add_filter( 'lcpfi_no_posts_message', function () { return 'Nothing here yet.'; } );` == Screenshots == 1. Gallery page in the front-end. 2. Showing shortcode on plugin section back-end. 3. Using shortcode on back-end & same as its working with phpcode using do_shortcode(). == Changelog == = 1.3.0 = * New: plugin dashboard in the admin area, under the "Post Gallery" menu, with an overview, getting started steps, full shortcode reference, changelog and support links. * New: the dashboard lists the post types available on your site, so you always know what to put in the post_type attribute. * New: "Dashboard" link next to Deactivate on the Plugins screen. * Security: escape all output (post titles, permalinks and image attributes). * Security: validate `post_type` against public post types, clamp `limit` to 1-100 and whitelist `order`. * Security: removed unsanitised `$_SERVER['REQUEST_URI']` parsing, which was also unused. * Security: added a direct file access guard. * Fix: pagination links now build correctly with plain permalinks, query strings and static front pages. * Fix: the gallery no longer renders an empty block when there are no matching posts. Output stays empty as before; use the `lcpfi_no_posts_message` filter to show a message. * Fix: `limit="-1"` still means "show everything", now resolved to the 100 per page cap. * Fix: removed the invalid `page` query argument and unused globals. * Improved: namespaced CSS. The generic `.row` and Bootstrap `col-md-3` classes are gone, so the plugin no longer collides with theme or page builder grids. * Improved: responsive CSS Grid layout with 4 / 3 / 2 / 1 columns and consistent image aspect ratios. * Improved: the stylesheet is only loaded on pages that use the shortcode, and is versioned for cache busting. The admin stylesheet only loads on the plugin's own page. * Improved: rewritten as classes with theme-overridable templates in `templates/`. * Improved: lowercase `[lcpostlist]` shortcode added, uppercase `[LCPOSTLIST]` kept for compatibility. * Improved: translation ready, and accessible pagination with a labelled `nav` element. = 1.2 = * Pagination support added to the shortcode. = 1.1 = * Placeholder image for posts without a featured image. = 1.0 = * Initial release. == Upgrade Notice == = 1.3.0 = Security release - please update. Also adds a plugin dashboard in the admin area, under the "Post Gallery" menu. IMPORTANT: your galleries will look different afterwards. Images are no longer locked to 163x177px; they now fill the column at a consistent aspect ratio, and the layout uses its own responsive grid instead of Bootstrap classes. Check any page using the shortcode after updating. Details: `.row` and `.col-md-3` are replaced by `.lcpfi-row` and `.lcpfi-col`, and the inner `.wpb_wrapper` div was removed, so custom CSS targeting those needs updating. Version 1.2 also styled every `.row` element on the site, not just its own; that no longer happens, which may affect unrelated parts of a theme that had come to rely on it. The shortcode, the `lcpfi_listpost()` and `lcpfi_pagination()` functions, the `LCPFI` stylesheet handle and all `LCPFI_*` constants are unchanged.