opengraph
This commit is contained in:
parent
9082150845
commit
a2fe3bed62
|
|
@ -85,6 +85,12 @@ class Posts extends ComponentBase
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'default' => '',
|
'default' => '',
|
||||||
],
|
],
|
||||||
|
'featured' => [
|
||||||
|
'title' => 'Featured posts',
|
||||||
|
'description' => 'Filter featured posts',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
|
||||||
|
],
|
||||||
'postsPerPage' => [
|
'postsPerPage' => [
|
||||||
'title' => 'rainlab.blog::lang.settings.posts_per_page',
|
'title' => 'rainlab.blog::lang.settings.posts_per_page',
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
|
|
@ -206,6 +212,7 @@ class Posts extends ComponentBase
|
||||||
'page' => $this->property('pageNumber'),
|
'page' => $this->property('pageNumber'),
|
||||||
'sort' => $this->property('sortOrder'),
|
'sort' => $this->property('sortOrder'),
|
||||||
'perPage' => $this->property('postsPerPage'),
|
'perPage' => $this->property('postsPerPage'),
|
||||||
|
'featured' => $this->property('featured'),
|
||||||
'search' => trim(input('q')),
|
'search' => trim(input('q')),
|
||||||
'category' => $category,
|
'category' => $category,
|
||||||
'date' => input('date'),
|
'date' => input('date'),
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,8 @@ class Post extends Model
|
||||||
'date' => '',
|
'date' => '',
|
||||||
'published' => true,
|
'published' => true,
|
||||||
'exceptPost' => null,
|
'exceptPost' => null,
|
||||||
'select' => null
|
'select' => null,
|
||||||
|
'featured' => null
|
||||||
], $options));
|
], $options));
|
||||||
|
|
||||||
$searchableFields = ['title', 'slug', 'excerpt'];
|
$searchableFields = ['title', 'slug', 'excerpt'];
|
||||||
|
|
@ -281,6 +282,9 @@ class Post extends Model
|
||||||
$query->isPublished();
|
$query->isPublished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($featured){
|
||||||
|
$query-> where('featured',1);
|
||||||
|
}
|
||||||
$date = trim($date);
|
$date = trim($date);
|
||||||
|
|
||||||
if(strtotime($date)){
|
if(strtotime($date)){
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ random = 0
|
||||||
<section class="hero">
|
<section class="hero">
|
||||||
<div class="auto__container">
|
<div class="auto__container">
|
||||||
<div class="hero__inner">
|
<div class="hero__inner">
|
||||||
|
|
||||||
{% partial 'slider' %}
|
{% partial 'slider' %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,21 @@ noPostsMessage = "No posts found"
|
||||||
sortOrder = "published_at desc"
|
sortOrder = "published_at desc"
|
||||||
categoryPage = "category"
|
categoryPage = "category"
|
||||||
postPage = "post"
|
postPage = "post"
|
||||||
|
|
||||||
|
[blogPosts featuredPosts]
|
||||||
|
pageNumber = "{{ :page }}"
|
||||||
|
postsPerPage = 8
|
||||||
|
noPostsMessage = "No posts found"
|
||||||
|
sortOrder = "published_at desc"
|
||||||
|
categoryPage = "category"
|
||||||
|
postPage = "post"
|
||||||
|
featured = 1
|
||||||
==
|
==
|
||||||
<div class="marquee">
|
<div class="marquee">
|
||||||
<a href="#" class="marquee__link">
|
<a href="#" class="marquee__link">
|
||||||
Главное
|
{{'Главное'|_}}
|
||||||
</a>
|
</a>
|
||||||
<div>{% for post in posts %} <span>{{post.title}}</span> {% endfor %}</div>
|
<div>{% for post in featuredPosts %} <a href="{{'post'|page({id:post.id,slug:post.slug})}}">{{post.title}}</a> {% endfor %}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="swiper-container mySwiper">
|
<div class="swiper-container mySwiper">
|
||||||
<div class="swiper-wrapper">
|
<div class="swiper-wrapper">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue