add files
This commit is contained in:
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]-->
|
||||
Reference in New Issue
Block a user