One of the things that came out when migrating from a single WordPress installation to a WordPress Network multi-site was the importance to display the latests posts from all the blogs inside my network in the main site. My first thought was “ok, maybe someone had the same issue and wrote a plugin“, if my idea wasn’t totally wrong, I couldn’t find anything suitable for my needs.
There were a lot of plugins but none of them actually gave me the freedom I needed, then I found the WPMU Recent Posts Widget written by Angelo from BitFreedom.com but it was conceived as a Widget for the ancient version of WordPress multisites (WPMU) and I was looking for something else, so what I did was to take his code and improve it to make it suitable to my needs. Thanks to his code the first versions of Network Latest Posts existed. I’d also thank people who contributed with their ideas and patches, thanks for your invaluable feedback! (you’re listed inside the main file, go check it out
)
Network Latest Posts today is way too different from what it used to be in past versions, it no longer uses Angelo’s code. Network Latest Posts version 3.0 is a major release, it was totally rewritten to use WordPress hooks and core functionalities which makes it run faster, and easy to maintain. Goodbye hackery and nasty workarounds, it wasn’t easy, I barely slept during the coding process, but it was worth it, it was fun, I learnt a lot of things I didn’t know and realized that WordPress advanced features need better documentation.
Enough introductory drivel. Let’s see the functionalities available in this version:
- @title : Widget/Shortcode main title (section title)
- @number_posts : Number of posts BY blog to retrieve. Ex: 10 means, retrieve 10 posts for each blog found in the network
- @time_frame : Period of time to retrieve the posts from in days. Ex: 5 means, find all articles posted in the last 5 days
- @title_only : Display post titles only, if false then excerpts will be shown
- @display_type : How to display the articles, as an: unordered list (ulist), ordered list (olist) or block elements
- @blog_id : None, one or many blog IDs to be queried. Ex: 1,2 means, retrieve posts for blogs 1 and 2 only
- @ignore_blog : It takes the same values as blog_id but in this case this blogs will be ignored. Ex: 1,2 means, display all but 1 and 2
- @thumbnail : If true then thumbnails will be shown, if active and not found then a placeholder will be used instead
- @thumbnail_wh : Thumbnails size, width and height in pixels, while using the shortcode or a function this parameter must be passed like: ’80×80′
- @thumbnail_class : Thumbnail class, set a custom class (alignleft, alignright, center, etc)
- @thumbnail_filler : Placeholder to use if the post’s thumbnail couldn’t be found, options: placeholder, kittens, puppies (what?.. I can be funny sometimes)
- @custom_post_type : Specify a custom post type: post, page or something-you-invented
- @category : Category or categories you want to display. Ex: cats,dogs means, retrieve posts containing the categories cats or dogs. If any articles match the category(ies) provided, all posts matching the rest of the parameters will be shown
- @tag : Same as categoy WordPress treats both taxonomies the same way; by the way, you can pass one or many (separated by commas). If any articles match the tag(s) provided, all posts matching the rest of the parameters will be shown
- @paginate : Display results by pages, if used then the parameter posts_per_page must be specified, otherwise pagination won’t be displayed
- @posts_per_page : Set the number of posts to display by page (paginate must be activated)
- @excerpt_length : Set the excerpt’s length in case you think it’s too long for your needs Ex: 40 means, 40 words (40 by default)
- @auto_excerpt : If true then it will generate an excerpt from the post content, it’s useful for those who forget to use the Excerpt field in the post edition page
- @excerpt_trail : Set the type of trail you want to append to the excerpts: text, image. The text will be _more_, the image is inside the plugin’s img directory and it’s called excerpt_trail.png
- @full_meta : Display the date and the author of the post, for the date/time each blog time format will be used
- @sort_by_date : Sorting capabilities, this will take all posts found (regardless their blogs) and sort them in order of recency, putting newest first
- @sorting_order : Specify the sorting order: ‘newer’ means from newest to oldest posts, ‘older’ means from oldest to newest
- @sorting_limit : Limit the number of posts to display. Ex: 5 means display 5 posts from all those found (even if 20 were found, only 5 will be displayed)
- @post_status : Specify the status of the posts you want to display: publish, new, pending, draft, auto-draft, future, private, inherit, trash
- @css_style : Use a custom CSS style instead of the one included by default, useful if you want to customize the front-end display: filename (without extension), this file must be located where your active theme CSS style is located. If multiple instances are used in the same page, all of them will be affected by this value (so you don’t need to pass this parameter to all the shortcodes/widgets included in the same page)
- @instance : This parameter is intended to differenciate each instance of the widget/shortcode/function you use, it’s required in order for the asynchronous pagination links to work
Installation
1. Upload `network-latest-posts folder` to the `/wp-content/plugins/` directory or go to the Network Admin panel > Plugins > Add New and search for Network Latest Posts
2. Activate the plugin for the network through the ‘Plugins’ menu in WordPress Network Admin panel
3. If you want to use the Widget, you can add the Network Latest Posts widget under ‘Appearance > Widgets‘
4. If you want to use the Shortcode, go to a page or post then click the NLPosts icon
in the TinyMCE editor or use [nlposts] (that’s it, seriously!)
Shortcode Parameters
[nlposts title=NULL
number_posts=10
time_frame=0
title_only=TRUE
display_type=ulist
blog_id=NULL
ignore_blog=NULL
thumbnail=FALSE
thumbnail_wh=80x80
thumbnail_class=NULL
thumbnail_filler=placeholder
custom_post_type=post
category=NULL
tag=NULL
paginate=FALSE
posts_per_page=NULL
excerpt_length=NULL
auto_excerpt=FALSE
excerpt_trail=text
full_meta=FALSE
sort_by_date=FALSE
sorting_order=NULL
sorting_limit=NULL
post_status=publish
css_style=NULL
instance=NULL
]
The $nlp_instance adds a class ‘.nlp-instance-X‘ where X is the instance identifier passed through the shortcode parameters (in case of Widgets this parameter is automatically taken from the Widget ID numbers for each instance created).
Screenshots
Shortcode
_____________________________________________
Widget
______________________________________________________
RTL Installations
_____________________________________________________
Examples
You can see this plugin working in my main network site www.8elite.com, I display there the latest posts from all the blogs inside my network. For full examples of use, please visit Network Latest Posts Test Lab.
Download
Download the latest version from the WordPress Plugin Directory: Network Latest Posts
Languages
This plugin is available in English, French, Spanish because that’s all the languages I know
and Italian (thanks to Valentino Deotto), if you would like to contribute to this project you can use the languages.pot file included inside the languages folder inside the plugin’s root folder. Use Poedit to create the translation files, once you have the .mo and .po files send them by mail to opensource[at]laelite.info make sure you include your name and URL (if you have one) so I give you credit for it.
Donations
If you think this plugin is great and makes your life easier and your blogs look better, please consider making a donation. Even $1 can make a difference
!
















Pingback: WP Multisite Network Posts | DreamKunst
Pingback: Network Latest Posts – WordPress 3 Plugin | 8ª Elite in English
Pingback: WP Multisite Network Posts | jaffamonkey Quality Assurance
Pingback: Uppgift WordPress | PHP-utvecklare