add card_post_id
This commit is contained in:
31
blocks/card_post_id.php
Normal file
31
blocks/card_post_id.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
function card_post_id( $id, $news_date = '') {
|
||||||
|
|
||||||
|
$curr_post = get_post( $id );?>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="mini-card">
|
||||||
|
<?if ( has_post_thumbnail($curr_post->ID) ) :?>
|
||||||
|
<div class="mini-card-img">
|
||||||
|
<a href="<?the_permalink($curr_post->ID);?>"><img class="mini-card-img" src="<?php echo get_the_post_thumbnail_url($curr_post->ID); ?>" alt="<?=$curr_post->post_title;?>">
|
||||||
|
<?if( has_tag( 'видео' ) ):?>
|
||||||
|
<span class="play-card"></span>
|
||||||
|
<?endif?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?endif?>
|
||||||
|
<h2 class="mini-card-title"><a href="<?the_permalink($curr_post->ID);?>"><?=$curr_post->post_title?></a></h2>
|
||||||
|
<div class="mini-card-body">
|
||||||
|
<div class="news_date">
|
||||||
|
<?if ($news_date == ''):?>
|
||||||
|
<?=get_the_time('j F Y, G:i', $curr_post->ID);?>
|
||||||
|
<?else:?>
|
||||||
|
<?=$news_date?>
|
||||||
|
<?endif?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?}?>
|
||||||
@@ -17,6 +17,7 @@ require get_template_directory().'/src/calend-block.php';
|
|||||||
require get_template_directory().'/src/calendar.php';
|
require get_template_directory().'/src/calendar.php';
|
||||||
require get_template_directory().'/src/perevod.php';
|
require get_template_directory().'/src/perevod.php';
|
||||||
require get_template_directory().'/lang.php';
|
require get_template_directory().'/lang.php';
|
||||||
|
require get_template_directory().'/blocks/card_post_id.php';
|
||||||
|
|
||||||
//require ABSPATH.'vendor/masterforweb/db_lite/db_lite.php';
|
//require ABSPATH.'vendor/masterforweb/db_lite/db_lite.php';
|
||||||
|
|
||||||
|
|||||||
14
index.php
14
index.php
@@ -38,20 +38,8 @@ $nn = 0;?>
|
|||||||
<?$nn++?>
|
<?$nn++?>
|
||||||
|
|
||||||
<?if ($nn == 10):?>
|
<?if ($nn == 10):?>
|
||||||
|
|
||||||
<div class="mini-card">
|
|
||||||
<?$block_href = "https://vetandlife.ru/sobytiya/veterinariya-i-zhizn-obyavlyaet-o-novom-fotokonkurse-sovremennoe-zhivotnovodstvo-i-veterinariya/";?>
|
|
||||||
|
|
||||||
<div class="mini-card-img">
|
<?card_post_id(18170, 'до 31 марта 2022 года')?>
|
||||||
<a href="<?=$block_href?>">
|
|
||||||
<img class="mini-card-img" src="https://vetandlife.ru/wp-content/uploads/2022/01/Nikola-Stojadinovic-iStock.jpg" alt="«Ветеринария и жизнь» объявляет о новом фотоконкурсе «Современное животноводство и ветеринария»">
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<h2 class="mini-card-title"><a href="<?=$block_href?>">«Ветеринария и жизнь» проводит новый фотоконкурс «Современное животноводство и ветеринария»</a></h2>
|
|
||||||
<div class="mini-card-body">
|
|
||||||
<div class="news_date">до 31 марта 2022 года</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user