add mored evevnts
This commit is contained in:
@@ -7,14 +7,14 @@ $posts = get_posts( array(
|
||||
'order' => 'DESC',
|
||||
'include' => array(),
|
||||
'exclude' => array(),
|
||||
'meta_key' => '',
|
||||
'meta_value' =>'',
|
||||
'post_type' => 'post',
|
||||
'post__not_in' => array($post_id),
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => '_thumbnail_id',
|
||||
//'compare' => 'EXISTS'
|
||||
'key' => 'startevent',
|
||||
'orderby' => 'meta_value',
|
||||
'order' => 'DESC'
|
||||
|
||||
)
|
||||
),
|
||||
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
||||
|
||||
44
blocks/moread_events.php
Normal file
44
blocks/moread_events.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
$more_posts = get_posts( array(
|
||||
'numberposts' => 6,
|
||||
'category' => 61, // пока тольео события
|
||||
'meta_key' => 'startevent',
|
||||
'meta_value' =>'',
|
||||
'post_type' => 'post',
|
||||
'post__not_in' => array($post_id),
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => '_thumbnail_id',
|
||||
//'compare' => 'EXISTS'
|
||||
)
|
||||
),
|
||||
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
||||
) );
|
||||
|
||||
# вывод поста
|
||||
if( $more_posts ):
|
||||
$nr = 0;?>
|
||||
|
||||
<div class="moread_rubric">Другие мероприятия:</div>
|
||||
|
||||
<div class="moread">
|
||||
|
||||
<?php foreach($more_posts as $post):
|
||||
$nr++;
|
||||
setup_postdata( $post );?>
|
||||
|
||||
<div class="moread_card" id="moread_<?=$nr?>">
|
||||
<?$imgurl = IMGSERVER.'news/512x340/'.str_replace('https://vetandlife.ru/wp-content/uploads/', '', get_the_post_thumbnail_url($post, 'full'))?>
|
||||
<img src="<?php echo $imgurl;?>" alt="<?the_title();?>">
|
||||
<div class="moread_title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></div>
|
||||
<div class="moread_date"><?the_time('j F Y, G:i');?></div>
|
||||
</div>
|
||||
|
||||
<?php endforeach;?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php wp_reset_postdata();
|
||||
|
||||
endif?>
|
||||
@@ -50,7 +50,9 @@
|
||||
|
||||
</div>
|
||||
|
||||
<?php include get_template_directory().'/blocks/yets.php';?>
|
||||
<?php include get_template_directory().'/blocks/moread_events.php';?>
|
||||
|
||||
<?php // include get_template_directory().'/blocks/yets.php';?>
|
||||
|
||||
<div id="tags">
|
||||
<?php the_tags();?>
|
||||
@@ -65,8 +67,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include get_template_directory().'/blocks/moread.php';?>
|
||||
|
||||
<div class="publ-to-main"><a href="https://vetandlife.ru"> <span class="arrow-go-main"><</span> <span class="go-to-main">На главную</span></a></div>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user