Descrição
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. Defaultpost.limit– posts per page, 1 to 100.-1means “as many as possible” and resolves to 100. Default5.order–ASCorDESC. DefaultDESC.pagination–onoroff. Defaulton.
In a theme file:
<?php echo do_shortcode( '[lcpostlist post_type="post" limit="8"]' ); ?>
Ecrãs



Instalação
Use WordPress Add New Plugin feature, searching “List Custom Post with featured image”, or download the archive and:
- Unzip the archive on your computer
- Upload the
list-custom-post-with-featured-imagedirectory to the/wp-content/plugins/directory - Activate the plugin through the ‘Plugins’ menu in WordPress
- Use the shortcode to show the post gallery anywhere
Perguntas frequentes
-
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-gapand--lcpfi-ratiothe same way. -
How do I change the markup?
-
Copy any file from the plugin’s
templates/folder into alcpfi/folder in your theme, for exampleyourtheme/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.'; } );
Avaliações
Contribuidores e programadores
“List Custom Post with featured image” é software de código aberto. As seguintes pessoas contribuíram para este plugin:
ContribuidoresTraduza o “List Custom Post with featured image” para o seu idioma.
Interessado no desenvolvimento?
Consulte o código, consulte o repositório SVN, ou subscreva o registo de alterações por RSS.
Registo de alterações
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_typeagainst public post types, clamplimitto 1-100 and whitelistorder. - 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_messagefilter to show a message. - Fix:
limit="-1"still means “show everything”, now resolved to the 100 per page cap. - Fix: removed the invalid
pagequery argument and unused globals. - Improved: namespaced CSS. The generic
.rowand Bootstrapcol-md-3classes 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
navelement.
1.2
- Pagination support added to the shortcode.
1.1
- Placeholder image for posts without a featured image.
1.0
- Initial release.