PHP function only returns date on some posts - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Saturday, March 5, 2022

PHP function only returns date on some posts

I am using the following code in my wordpress page:

<article>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();?>
<section>
<h1><?php the_title(); ?></h1>
<p>Uppladdat <?php echo the_date('I M Y');?> <?php echo get_post_time('H:i:s'); ?></p>
<p><?php the_content(); ?></p>
</section>
<?php endwhile; endif;?>
</article>

And on the first blog post, it shows the date and time it's posted. On the second post, it shows only the time. On the third one, it shows date and time again.

What is happening here?



source https://stackoverflow.com/questions/71355716/php-function-only-returns-date-on-some-posts

No comments:

Post a Comment