add fix problem
This commit is contained in:
35
blocks/mainnews.php
Normal file
35
blocks/mainnews.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
$params = array(
|
||||
'posts_per_page' => -1, // нужно для отображения всех постов, без разделения по страницам
|
||||
'post__in' => get_option( 'sticky_posts' ),
|
||||
'posts_per_page' => 1
|
||||
);
|
||||
|
||||
$q = new WP_Query( $params );
|
||||
|
||||
if ( $q->have_posts() ) :
|
||||
$q->the_post();
|
||||
$mainpost_id = get_the_ID();
|
||||
?>
|
||||
|
||||
<div class="main-card">
|
||||
|
||||
<?if ( has_post_thumbnail() ) :?>
|
||||
<div class="card-img-top">
|
||||
<a href="<?the_permalink();?>"><img src="<?php echo get_the_post_thumbnail_url(null, 'full'); ?>" alt="<?the_title();?>"></a>
|
||||
</div>
|
||||
<?endif?>
|
||||
|
||||
<h2 class="main-card-title"><a href="<?the_permalink();?>"><?the_title();?></a></h2>
|
||||
<div class="main-card-body">
|
||||
<div class="main-card-text"><a href="<?the_permalink();?>"><?the_excerpt();?></a></div>
|
||||
<div class="news_date"><?the_time('j F Y, G:i');?></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php endif; wp_reset_postdata();
|
||||
Reference in New Issue
Block a user