[wp-trac] [WordPress Trac] #42534: get_post_time is adding or dropping a day on the front end.
WordPress Trac
noreply at wordpress.org
Mon Nov 13 19:26:50 UTC 2017
#42534: get_post_time is adding or dropping a day on the front end.
-------------------------------+------------------------------------
Reporter: keyinora | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Date/Time | Version: 4.9
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses: rest-api, performance
-------------------------------+------------------------------------
Comment (by keyinora):
Sure no problem, i have attached a screenshot of my timezone settings,
please let me know if you don't see it!
Here is the home.php basic code i have, you will see i call a template of
"templates/archive-post" to retrieve a template of the repeated code.
{{{#!php
<?php
<?php if (have_posts()) : while (have_posts()) :
the_post();
get_template_part( 'templates/archive-
post' );?>
<?php endwhile;endif;?>
<?php get_template_part( 'templates/pagination'
);?>
}}}
Here is my template code.
{{{#!php
<?php
<?php
$bot_timestamp = get_post_time('Y-m-d', true);
$user_timestamp = get_post_time('F j, Y', true);
$author = get_the_author();
?>
<article id="blog-<?php the_ID();?>" class="row top-xs center-xs start-
md">
<figure class="col-xs-12 col-md-3">
<?php if (has_post_thumbnail()): ?>
<?php the_post_thumbnail('medium', array('alt' =>
esc_attr(get_the_title()), 'title'=> esc_attr(get_the_title()), 'class
'=>'img-circle')); ?>
<?php else: ?>
<?php $image = gfield('default_blog_image', 'options'); ?>
<img class="img-circle" src="<?php echo
$image['sizes']['medium']; ?>" width="<?php echo $image['sizes']['medium-
width']; ?>" height="<?php echo $image['sizes']['medium-height']; ?>"
alt="<?php echo $image['alt']; ?>" title="<?php echo $image['title'] ?>"
/>
<?php endif; ?>
</figure>
<div class="col-xs-12 col-md-9">
<h3><a href="<?php the_permalink(); ?>" title="<?php
the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<h6><time datetime="<?php echo $bot_timestamp; ?>"><?php
echo $user_timestamp; ?></time></h6>
<?php the_excerpt(); ?>
</div>
</article>
}}}
Let me know if i need to provide additional information!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42534#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list