add files
This commit is contained in:
24
template-parts/home/ajax-load-more.php
Normal file
24
template-parts/home/ajax-load-more.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<!--[home/ajax-load-more]-->
|
||||
|
||||
<?php
|
||||
|
||||
global $main_item, $colon_item;
|
||||
|
||||
$index_alm_shortcode = '
|
||||
[ajax_load_more
|
||||
cache="true"
|
||||
cache_id="' . get_alm_cache_id( 955 ) . '"
|
||||
post_type="profile_article"
|
||||
repeater="template_22"
|
||||
posts_per_page="21"
|
||||
post_format="standard"
|
||||
post__not_in="'. implode([",", $main_item, $colon_item]) .'"
|
||||
offset="24"
|
||||
id="home_page"
|
||||
]';
|
||||
|
||||
echo do_shortcode( $index_alm_shortcode );
|
||||
|
||||
?>
|
||||
|
||||
<!--[/home/ajax-load-more]-->
|
||||
20
template-parts/home/cell-image.php
Normal file
20
template-parts/home/cell-image.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<!--[archive/cell-image]-->
|
||||
|
||||
<?php if( has_post_thumbnail() ) : ?>
|
||||
|
||||
<img loading="lazy"
|
||||
src="<?= the_post_thumbnail_url($args["wide"] && !wp_is_mobile() ? "large" : "post-thumbnail"); ?>"
|
||||
alt="<?= htmlspecialchars( get_the_title() ) ?>"
|
||||
/>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<img loading="lazy"
|
||||
itemprop="image"
|
||||
src="<?= wp_get_attachment_image_url( 1357368, $args["wide"] && !wp_is_mobile() ? "large" : "post-thumbnail"); ?>"
|
||||
alt="<?= htmlspecialchars( get_the_title() ) ?>"
|
||||
/>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<!--[archive/cell-image]-->
|
||||
39
template-parts/home/cell.php
Normal file
39
template-parts/home/cell.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<!--[home/cell(wide => <?= $args["wide"] ?>)]-->
|
||||
|
||||
<div class="col-12 col-md-4 col-xl-<?= $args["wide"] ? 6 : 3 ?> float-left">
|
||||
|
||||
<?php //get_template_part("template-parts/micro/post"); ?>
|
||||
|
||||
<div class="article cell">
|
||||
|
||||
<a class="article__frame <?= $args["wide"] ? "article__frame--wide" : "" ?>" href="<?= the_permalink() ?>" title="<?= htmlspecialchars( get_the_title() ) ?>">
|
||||
|
||||
<?php get_template_part("template-parts/home/cell-image"); ?>
|
||||
|
||||
</a>
|
||||
|
||||
<?php get_template_part("template-parts/post/cell-sticker"); ?>
|
||||
|
||||
<div class="article__body">
|
||||
|
||||
<?php get_template_part("template-parts/post/cell-date"); ?>
|
||||
|
||||
<a class="article__title" href="<?= the_permalink() ?>" title="<?= htmlspecialchars( get_the_title() ) ?>">
|
||||
|
||||
<?= the_title() ?>
|
||||
|
||||
</a>
|
||||
|
||||
<div class="article__detail">
|
||||
|
||||
<?php get_template_part("template-parts/post/cell-author"); ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--[/home/cell(wide => <?= $args["wide"] ?>)]-->
|
||||
96
template-parts/home/colon-item.php
Normal file
96
template-parts/home/colon-item.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<!--[home/colon-item]-->
|
||||
|
||||
<?php
|
||||
|
||||
global $main_item, $colon_item;
|
||||
|
||||
$colon_query = new WP_Query(
|
||||
[
|
||||
"post_type" => ["anew", "profile_article"],
|
||||
"post_status" => "publish",
|
||||
"meta_query" => [
|
||||
"relation" => "AND",
|
||||
[
|
||||
"key" => "colon_item",
|
||||
"value" => "true",
|
||||
"compare" => "LIKE"
|
||||
]
|
||||
],
|
||||
"posts_per_page" => 1,
|
||||
"suppress_filters" => true,
|
||||
"ignore_sticky_posts" => true,
|
||||
"order" => "DESC",
|
||||
"orderby" => "post_date"
|
||||
]
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<?php if($colon_query->have_posts()): ?>
|
||||
|
||||
<?php while ($colon_query->have_posts()): ?>
|
||||
|
||||
<?php $colon_query->the_post(); ?>
|
||||
|
||||
<?php $colon_item = get_the_ID(); ?>
|
||||
|
||||
<div class="d-flex" >
|
||||
|
||||
<div class="blog"
|
||||
itemscope
|
||||
<?php if( get_post_type() == "profile_article"): ?>
|
||||
itemtype="https://schema.org/Article"
|
||||
<?php else: ?>
|
||||
itemtype="https://schema.org/NewsArticle"
|
||||
<?php endif; ?>
|
||||
>
|
||||
|
||||
<a class="blog__frame" href="<?= the_permalink() ?>">
|
||||
|
||||
<img loading="lazy"
|
||||
itemprop="image"
|
||||
class="d-block"
|
||||
src="<?= the_post_thumbnail_url( [ 264, 264 ] ); ?>"
|
||||
width="167"
|
||||
height="158"
|
||||
alt="<?= htmlspecialchars( get_the_title() ) ?>"
|
||||
/>
|
||||
|
||||
</a>
|
||||
<div class="blog__body">
|
||||
|
||||
<a class="blog__title" href="<?= the_permalink() ?>">
|
||||
|
||||
<?php if( function_exists('get_secondary_title') && get_secondary_title() ) : ?>
|
||||
|
||||
<?= the_secondary_title() ?>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<?= the_title() ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</a>
|
||||
|
||||
<?php get_template_part("template-parts/micro/post"); ?>
|
||||
|
||||
<div class="blog__detail">
|
||||
|
||||
<?php get_template_part("template-parts/post/blog-date"); ?>
|
||||
|
||||
<?php get_template_part("template-parts/post/blog-author"); ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<!--[/home/colon-item]-->
|
||||
29
template-parts/home/index.php
Normal file
29
template-parts/home/index.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<!--[home/index]-->
|
||||
|
||||
<?php get_template_part("template-parts/home/news"); ?>
|
||||
|
||||
<div class="col-12 col-md-8 col-xl-6 float-left">
|
||||
|
||||
<?php get_template_part("template-parts/home/main-item") ?>
|
||||
|
||||
<?php get_template_part("template-parts/home/colon-item") ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-4 col-xl-3 float-right d-none d-xl-block">
|
||||
|
||||
<div class="special special--gray d-flex cell cell--double justify-content-center align-items-center">
|
||||
|
||||
<?php get_template_part("template-parts/ad/revive/ad", "", [ "zone" => 1 ]) ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php get_template_part("template-parts/home/list-items") ?>
|
||||
|
||||
|
||||
<?php get_template_part("template-parts/home/ajax-load-more") ?>
|
||||
|
||||
<!--[/home/index]-->
|
||||
41
template-parts/home/list-items.php
Normal file
41
template-parts/home/list-items.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<!--[home/list-items]-->
|
||||
|
||||
<?php
|
||||
|
||||
global $main_item, $colon_item;
|
||||
|
||||
$mainpage_query = new WP_Query(
|
||||
[
|
||||
"post_type" => ["profile_article"],
|
||||
"post_status" => "publish",
|
||||
"posts_per_page" => 22,
|
||||
"ignore_sticky_posts" => true,
|
||||
"order" => "DESC",
|
||||
"orderby" => "post_date",
|
||||
"post__not_in" => [$main_item, $colon_item]
|
||||
]
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<?php if($mainpage_query->have_posts()): ?>
|
||||
|
||||
<?php while ($mainpage_query->have_posts()): ?>
|
||||
|
||||
<?php $mainpage_query->the_post(); ?>
|
||||
|
||||
<?php if ( in_array( $mainpage_query->current_post, [8, 16] ) ): ?>
|
||||
|
||||
<?php get_template_part("template-parts/home/cell", "", ["wide" => true]); ?>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<?php get_template_part("template-parts/home/cell", "", ["wide" => false]); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<!--[/home/list-items]-->
|
||||
83
template-parts/home/main-item.php
Normal file
83
template-parts/home/main-item.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<!--[home/main-item]-->
|
||||
|
||||
<?php
|
||||
|
||||
global $main_item, $colon_item;
|
||||
|
||||
$first_query = new WP_Query(
|
||||
[
|
||||
"post_type" => ["anew", "profile_article"],
|
||||
"post_status" => "publish",
|
||||
"meta_query" => [
|
||||
"relation" => "AND",
|
||||
[
|
||||
"key" => "main_item",
|
||||
"value" => "true",
|
||||
"compare" => "LIKE"
|
||||
]
|
||||
],
|
||||
"posts_per_page" => 1,
|
||||
"suppress_filters" => true,
|
||||
"ignore_sticky_posts" => true,
|
||||
"order" => "DESC",
|
||||
"orderby" => "post_date"
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<?php if($first_query->have_posts()): ?>
|
||||
|
||||
<?php while ($first_query->have_posts()): ?>
|
||||
|
||||
<?php $first_query->the_post(); ?>
|
||||
|
||||
<?php $main_item = get_the_ID(); ?>
|
||||
|
||||
<div class="article article--main cell cell--main"
|
||||
itemscope
|
||||
<?php if( get_post_type() == "profile_article"): ?>
|
||||
itemtype="https://schema.org/Article"
|
||||
<?php else: ?>
|
||||
itemtype="https://schema.org/NewsArticle"
|
||||
<?php endif; ?>
|
||||
>
|
||||
|
||||
<?php get_template_part("template-parts/micro/post"); ?>
|
||||
|
||||
<a class="article__frame" href="<?= the_permalink() ?>">
|
||||
|
||||
<img loading="lazy"
|
||||
itemprop="image"
|
||||
class="d-block"
|
||||
src="<?= the_post_thumbnail_url("large"); ?>"
|
||||
alt="<?= htmlspecialchars( get_the_title() ) ?>"
|
||||
/>
|
||||
|
||||
</a>
|
||||
|
||||
<?php get_template_part("template-parts/post/cell-sticker"); ?>
|
||||
|
||||
<div class="article__body">
|
||||
|
||||
<?php get_template_part("template-parts/post/cell-date"); ?>
|
||||
|
||||
<a class="article__title article__title--lg" href="<?= the_permalink() ?>">
|
||||
|
||||
<?= the_title(); ?>
|
||||
|
||||
</a>
|
||||
|
||||
<?php get_template_part("template-parts/post/cell-author"); ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<!--[/home/main-item]-->
|
||||
21
template-parts/home/news-item.php
Normal file
21
template-parts/home/news-item.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<li>
|
||||
|
||||
<?php //get_template_part("template-parts/micro/post"); ?>
|
||||
|
||||
<time datetime="<?= get_the_date("d.m.Y H:i:s") ?>" class="news__time">
|
||||
|
||||
<?= get_the_date("H:i") ?>
|
||||
|
||||
</time>
|
||||
|
||||
<a class="news__name <?= get_post_meta( get_the_ID(), "_breaking", true ) == 1 ? "active" : "" ?>" href="<?= the_permalink() ?>" title="<?= htmlspecialchars( get_the_title() ) ?>">
|
||||
|
||||
<?= the_title() ?>
|
||||
|
||||
</a>
|
||||
|
||||
<?php //get_template_part("template-parts/micro/author"); ?>
|
||||
|
||||
<?php //get_template_part("template-parts/micro/image"); ?>
|
||||
|
||||
</li>
|
||||
19
template-parts/home/news-top-item.php
Normal file
19
template-parts/home/news-top-item.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<!--[home/news-top-item]-->
|
||||
|
||||
<li>
|
||||
|
||||
<?php //get_template_part("template-parts/micro/post"); ?>
|
||||
|
||||
<a class="news__name" href="<?= the_permalink() ?>" title="<?= htmlspecialchars( get_the_title() ) ?>">
|
||||
|
||||
<?= the_title() ?>
|
||||
|
||||
</a>
|
||||
|
||||
<?php //get_template_part("template-parts/micro/author"); ?>
|
||||
|
||||
<?php //get_template_part("template-parts/micro/image"); ?>
|
||||
|
||||
</li>
|
||||
|
||||
<!--[/home/news-top-item]-->
|
||||
165
template-parts/home/news.php
Normal file
165
template-parts/home/news.php
Normal file
@@ -0,0 +1,165 @@
|
||||
<!--[home/news]-->
|
||||
|
||||
<?php
|
||||
|
||||
$news_date = "";
|
||||
|
||||
$news_query = new WP_Query(
|
||||
[
|
||||
"post_type" => ["anew", "yellow"],
|
||||
"ignore_sticky_posts" => true,
|
||||
"posts_per_page" => 20,
|
||||
"order" => "DESC",
|
||||
"orderby" => "post_date"
|
||||
]
|
||||
);
|
||||
|
||||
$top = json_decode(
|
||||
get_option("ppp_options")
|
||||
);
|
||||
|
||||
$ids = array_filter(
|
||||
array_map(
|
||||
function ($item) {
|
||||
return $item->id;
|
||||
}, $top
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$top_query = new WP_Query(
|
||||
[
|
||||
"post_type" => ["anew", "yellow"],
|
||||
"ignore_sticky_posts" => true,
|
||||
"post__in" => $ids,
|
||||
"posts_per_page" => -1,
|
||||
"order" => "DESC",
|
||||
"orderby" => "post_date"
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
<div class="col-12 col-md-4 col-xl-3 float-left">
|
||||
|
||||
<div class="news cell d-flex">
|
||||
|
||||
<ul class="nav nav-tabs news__tabs">
|
||||
|
||||
<li class="nav-item">
|
||||
|
||||
<a class="nav-link active" data-toggle="tab" data-target="#tab-news" href="/news/">
|
||||
|
||||
Новости
|
||||
|
||||
</a>
|
||||
|
||||
<a class="nav-link" href="/news/">
|
||||
|
||||
Новости
|
||||
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
|
||||
<a class="nav-link" data-toggle="tab" href="#tab-top10">
|
||||
|
||||
Топ-10
|
||||
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="tab-content news__tabs-content">
|
||||
|
||||
<div class="tab-pane active container" id="tab-news">
|
||||
|
||||
<div class="news__body">
|
||||
|
||||
<div class="scrollbar-macosx js-scrollbar">
|
||||
|
||||
<div class="news__body__inner" >
|
||||
|
||||
<?php if($news_query->have_posts()): ?>
|
||||
|
||||
<?php while ($news_query->have_posts()): ?>
|
||||
|
||||
<?php $news_query->the_post(); ?>
|
||||
|
||||
<?php if( $news_date !== get_the_date("Ymd") ): ?>
|
||||
|
||||
<?php $news_date = get_the_date("Ymd"); ?>
|
||||
|
||||
<?php if( $news_query->current_post !== 0 ) : ?>
|
||||
|
||||
</ul>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="news__date">
|
||||
|
||||
<?= get_the_date("d.m.Y") ?>
|
||||
|
||||
</div>
|
||||
|
||||
<ul class="news__list">
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php get_template_part("template-parts/home/news-item"); ?>
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane container" id="tab-top10">
|
||||
|
||||
<div class="news__body">
|
||||
|
||||
<div class="scrollbar-macosx js-scrollbar">
|
||||
|
||||
<div class="news__body__inner">
|
||||
|
||||
<ul class="news__list__top">
|
||||
|
||||
<?php if($top_query->have_posts()): ?>
|
||||
|
||||
<?php while ($top_query->have_posts()): ?>
|
||||
|
||||
<?php $top_query->the_post(); ?>
|
||||
|
||||
<?php get_template_part("template-parts/home/news-top-item"); ?>
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!--[/home/news]-->
|
||||
Reference in New Issue
Block a user