Answer the question
In order to leave comments, you need to log in
Why isn't all post data showing up?
When displaying the feedback block in the page template, everything is fine:
<div class="recall_block" style="background-image: url('<?php echo get_template_directory_uri() ?>/assets/img/bg_recall.jpg');">
<div class="container">
<div class="custom_title text-center">
<h2>Отзывы клиентов</h2>
</div>
<div class="row">
<?php
// параметры по умолчанию
$args = array(
'numberposts' => 3,
'post_type' => 'reviews',
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
);
$posts = get_posts( $args );
foreach($posts as $post): setup_postdata($post)?>
<div class="col">
<div class="recall">
<div class="picture">
<img src="<?php the_post_thumbnail_url( 'full' );?>">
</div>
<div class="name"><?php the_title(); ?></div>
<p><?php echo get_the_content(); ?></p>
</div>
</div>
<?php endforeach;
wp_reset_postdata(); // сброс
?>
</div>
<div class="row">
<div class="col text-center">
<div class="watch_all"><a href="#/reviews/">Смотреть все</a></div>
</div>
</div>
</div>
</div>
if ( ! function_exists( 'mebel_reviews' ) ) {
function mebel_reviews(){
?>
<div class="recall_block" style="background-image: url('<?php echo get_template_directory_uri() ?>/assets/img/bg_recall.jpg');">
<div class="container">
<div class="custom_title text-center">
<h2>Отзывы клиентов</h2>
</div>
<div class="row">
<?php
// параметры по умолчанию
$args = array(
'numberposts' => 3,
'post_type' => 'reviews',
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
);
$posts = get_posts( $args );
foreach($posts as $post): setup_postdata($post)?>
<div class="col">
<div class="recall">
<div class="picture">
<img src="<?php the_post_thumbnail_url( 'full' );?>">
</div>
<div class="name"><?php the_title(); ?></div>
<p><?php echo get_the_content(); ?></p>
</div>
</div>
<?php endforeach;
wp_reset_postdata(); // сброс
?>
</div>
<div class="row">
<div class="col text-center">
<div class="watch_all"><a href="http://mebel.amtex.by/reviews/">Смотреть все</a></div>
</div>
</div>
</div>
</div>
<?php
}
}
Answer the question
In order to leave comments, you need to log in
Try to add at the beginning of the function global $post;
(or before the start of the foreach).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question