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
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:
<?php echo do_shortcode( '[lcpostlist post_type="post" limit="8"]' ); ?>
Screenshots

Gallery page in the front-end.

Showing shortcode on plugin section back-end.

Using shortcode on back-end & same as its working with phpcode using do_shortcode().
FAQ
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.'; } );
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