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