mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Merge pull request #577 from SpeksForks/exclude-current-post-in-recent-widget
MINOR: avoid current blog post being included in the recent posts widget
This commit is contained in:
commit
1c42689290
@ -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