Home My Plugins Latest Post Shortcode 9.5

Latest Post Shortcode 9.5

The features introduced in version 9.5 include the infinite scroll, the slider wrapper configurable element, the pagination limit, support for multiple image placeholders, the shortcode cache, and UI styles updates. The “Latest Post Shortcode” helps you display a custom selection of articles as a list, as a grid, or even as a responsive slider (posts, pages, your custom post types, attachments) in a page/sidebar, without having to code or know PHP.

Latest Post Shortcode Banner

Details and demo

The button for configuring the shortcode is displayed as an icon or as the LPS button, depending on the mode you use when adding/updating content (the posts, pages, widgets, etc.):

  • in the Visual mode of the editor, the button appears in the toolbar as an icon
  • in the Text mode of the editor, the button appears in the toolbar as the LPS button

The button for the shortcode configurator can be used:

  • when adding/editing posts, pages, text widgets
  • in the Classic block for Gutenberg
  • for version >= 8.7 the button is also available in Elementor.

Infinite Scroll

The pagination option allows you to configure the output of the selected articles as an infinite scroll. NEW This option will populate more items that match the filtering criteria when you scroll the page.

Latest Post Shortcode 9.5 Infinite Scroll

The option is available in the pagination visibility dropdown, as Infinite scroll (load more on scroll).

When you are using this option, you would still be able to set the number of posts to be displayed per iteration, the custom text that is displayed when the items are fetched, and the maximum limit of items, see more details below.

For demo purposes, my shortcode example limits the results to 9 items.

[latest-selected-content perpage="3" limit="9" showpages="scroll" loadtext="Loading more articles ..." pagespos="1" display="title,excerpt-small" titletag="strong" chrlimit="60" url="yes" linktext="Read more" image="thumbnail" elements="3" css="sample-white three-columns as-overlay light tall" type="post" taxonomy="category" term="travels" orderby="dateD" show_extra="ajax_pagination,dark_spinner"]

Slider Wrapper

As you probably know, I am testing my code in different environments, with different combinations of themes, plugins, and core versions. When testing the slider with Twenty Twenty (which is the default theme starting with WordPress 5.3), I saw that the theme styles make it pretty difficult to align the slider as needed inside the pages.

Latest Post Shortcode 9.5 Slider Wrapper Element

To make it easier for overriding the styles, I added the option to choose which HTML element would wrap the slides.

By default, the div element is used, but you can select a p or a span instead.

Pagination Limit

NEW Starting with this version the number of posts attribute will be used to limit the paginated results.

This is very useful when you have a lot of articles but you only want to show the first 10 for example, but using also the pagination, load more button or infinite scroll options (for example 2 per page, to have 5 iterations) so that the page would still load fast.

If you do not need to limit the total number of posts, you have to remove the value of this attribute.

Multiple Image Placeholders

The attribute for image placeholder allows you to define one image to be used for the posts that do not have a featured image.

NEW Starting with this version, if you specify a list of images separated by comma (no spaces), a random one from the list will be picked for each article that does not have a featured image. This is very useful when you have a lot of articles without featured images, but you don’t want to show the same image for all of these.

UI Updates

MOD Starting with this version the shortcode configurator lightbox styles are updated, and the settings sections are separated for better visibility. The close button is more accessible and scrolling back to the top is faster now, as the up arrow was added in the right bottom corner of the lightbox, which is always available.

Also, when selecting different options that toggle other options, the hints are highlighted so that you can spot these right away and make the configuration needed for these.

Latest Post Shortcode 9.5 UI Updates
Latest Post Shortcode 9.5 UI Updates

Shortcode Cache

NEW Starting with this version the shortcode configurator has the option to cache the shortcode output. This is useful for optimizing the page load. The shortcode cache is removed when the post that embeds is updated, or when you click the remove cache button from the shortcode lightbox.

Other Updates

  • Tested up to 5.3.2;
  • Enqueue updates;
  • Slider default breakpoint set to 1200;
  • Update filters for post types, statuses, and taxonomies;
  • Display taxonomies slugs in the UI, to make it easier to identify these when having the same titles;
  • Fix slider preview when using the shortcode with Elementor;
  • Fix warning for no post type selected;
  • Fix item select when scrolling the settings lightbox;
  • Added the up arrow for the lightbox in small resolution view;
  • Added support for 5 and 6 columns (five-columnssix-columns);
  • Added support for aligning to left (align-left), center (align-center) or right (align-right) the tile content;
  • Fix the limit attribute not updating when configuring the shortcode as a slider;
  • Added demo video.

If you would like to support my work, please consider making a donation / buy me a coffee, leave a 5 stars rating, or share this plugin on your feed.
A huge thanks in advance!