Random posts allows you to pull posts without a specific order, you can pass other parameters then activate this to display posts randomly.
] // Display random posts
Using this parameter you can pull posts from a specific time frame, the value must be passed in number of days. It will pull the posts updated from today back until the number of days specified by you.
Please note, this parameter will affect posts updated between that period of time, this is important because even if you published a post 1 year ago, if you updated its content recently then it will be shown.
[slposts time_frame=20] // Pulls posts updated from now 20 days ago
If you want to limit the total number of posts to display and apply sorting order then you could use some interesting parameters included to make this an easy task. These parameters are useful when combined with multiple categories and/or tags.
You can order posts from Newest to Oldest ‘newest‘ or Oldest to Newest ‘oldest‘, check the code below:
[slposts sort_by_date=true sorting_order=oldest] // Display posts sorted by date from oldest to newest
[slposts sort_by_date=true sorting_limit=20] // Display the newest 20 posts found
// Advanced example
] // This will pull 50 posts from 3 categories, and display only 10
// from newest to oldest
It’s also important to note the pagination parameter should be used in combination with the instance identifier to avoid unexpected results when using multiple paginated shortcodes within the same page, as well as the posts_per_page parameter to specify the number of posts to be displayed per page, if this parameter is not specified, the pagination won’t work.
[slposts paginate=true posts_per_page=4] // Activates pagination and display 4 posts per page
] // Displays posts under category sports and sets instance identifier to sports
] // Displays posts under category technology and both work
// in the same page because identifiers are different
Single Latest Posts allows you to display thumbnails for posts, however your theme must support them. Optionally you can specify the width and height for thumbnails – please note, WordPress just crop images it doesn’t allow resizing (so images don’t lose their proportions) -, once your images has been uploaded these values won’t work if they are superior to the size of the thumbnail already registered, you must regenerate them with another plugin if you want to change this.
This plugin also includes placeholders for posts which doesn’t have thumbnails. There are three (3) different options for thumbnails fillers: placeholder (by default), kittens, puppies and optionally there is another one which you can set through the Single Latest Posts Settings page.
[slposts thumbnail=true] // Display thumbnails
[slposts thumbnail=true thumbnail_wh=80x80] // Crop thumbnails to 80px by 80px
[slposts thumbnail=true thumbnail_filler=puppies] // Sets puppies as thumbnail filler
[slposts thumbnail=true thumbnail_class=alignleft] // CSS class for your thumbnails
Metainformation is used to display the date, author and comments count (optional) for each post listed. The date will be formatted using the specified date format in blog settings.
It will also display the category(ies), tag(s) and permalink to the post. Everything is wrapped between specific HTML tags with styling purposes.
[slposts full_meta=true] // Display metainfo
[slposts full_meta=true display_comments=true] // Full meta must be true to use display comments
The excerpt is a summary or description of a post, WordPress includes an excerpt form field which you can use while creating or editing posts. Usually people forget to set this value, so Single Latest Posts allows you to create an extract from the content of the post.
There are some optional parameters: excerpt_length and excerpt_trail the first one sets the number of words the excerpt should display and the second receives two values, text or image, text is used by default, it adds “…more” to the end of the excerpt’s paragraph. When image is used, it will display the excerpt_trail.png image located inside the plugin’s core/img folder.
[slposts excerpt_length=55] // Limits excerpt length to 55 words
] // Create excerpt from post content limited to 40 words
[slposts excerpt_trail=image] // Set image as a "read more" link
Single Latest Posts include different display types that wrap content between specific HTML tags to simplify CSS styling. There are three (3) types: ulist, olist and block. By default unordered lists (ulist) are used.
You can of course manipulate CSS styles to control the visual presentation.
1.- Unordered lists: [slposts] // Style by default, you don't need to explicitly pass its value
2.- Ordered lists: [slposts display_type=olist]
3.- Blocks: [slposts display_type=block]
Taxonomy is one of the features making Single Latest Posts really competitive, it allows you to control which categories or tags should be listed. Something you should know is when taxonomy parameters are used, if no posts match the criteria then nothing will be shown. Important: categories and tags slugs must be used, instead of names, for example if you want to display posts under the category “My Category” you must use its slug: “my-category” otherwise it won’t work, the same goes for the tags.
If you want to pull posts from multiple categories and/or tags then you must pass slugs separated by commas ex: category=cat1,cat2,cat3 tag=tag1,tag2,tag3.
[slposts number_posts=10 category=usage tag=wordpress-plugin]
Single Latest Posts is really easy to use. You just have to decide what you can accomplish then pass the right parameters and that’s it!
If you just want to use the default settings, then just use this shortcode: