@MaksZhukov
programer

Почему the_date в цикле работе только в первой итерации wordpress?

Почему the_date в цикле работе только в первой итерации wordpress?
<?php
	            while ( have_posts() ) :
		            the_post();
		            ?>
                <div class="row article">
                    <div class="col-lg-4"><img class="img-responsive" src="<?php the_post_thumbnail_url(); ?>" alt="News"></div>
                    <div class="col desc">
                        <time><?php the_date( 'j F Y' ); ?></time>
                        <div class="author">Александр Иванов</div>
                        <a class="title" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                        <?php the_excerpt() ?>
                        <a class="more" href="<?php the_permalink(); ?>">Подробнее...</a>
                    </div>
                </div>
	            <?php endwhile;	?>
  • Вопрос задан
  • 69 просмотров
Решения вопроса 1
MedVedar
@MedVedar
e-commerce developer
Заглянем в фонкцию the_date и там увидим:
* Display or Retrieve the date the current post was written (once per date)
*
* Will only output the date if the current post's date is different from the
* previous one output.
*
* i.e. Only one date listing will show per day worth of posts shown in the loop, even if the
* function is called several times for each post.
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
Почему - не скажу, но всегда нужно использовать <?php echo get_the_date( 'j F Y' ); ?>. Всегда, увы почему - тоже не смогу найти, можете погуглить о причинах.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы