mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
MINOR: avoid current blog post being included in the recent posts widget
This commit is contained in:
parent
1d775aa664
commit
078c877cbb
@ -3,6 +3,7 @@
|
||||
namespace SilverStripe\Blog\Widgets;
|
||||
|
||||
use SilverStripe\Blog\Model\Blog;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Forms\DropdownField;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\Forms\NumericField;
|
||||
@ -81,6 +82,7 @@ class BlogRecentPostsWidget extends Widget
|
||||
|
||||
if ($blog) {
|
||||
return $blog->getBlogPosts()
|
||||
->filter('ID:not', Director::get_current_page()->ID)
|
||||
->sort('"PublishDate" DESC')
|
||||
->limit($this->NumberOfPosts);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user