How to get the date of last updated post or page and put it in the footer
How to get the date of last updated post or page and put it in the footer
How to get the date of last updated post or page and put it in the footer
WordPress change post date format from english to japanese
Add entry-date { display: none; } to the stylesheet. Better create a child theme and add the code to the newly created stylesheet, if you dont you may lose the code when you update your theme to a latest version.
Update setlocale(LC_TIME, “th_TH.UTF-8”); echo strftime(“%A %d %B %Y”, strtotime(get_the_date())); Before: อาทิตย์ 03 มกราคม 2016 //$strdate = get_thai_date(); //print_r($strdate[“number”]); //preg, strstr or others. //$strdate = date_i18n(…); After: อาทิตย์ ๐๓ มกราคม ๒๐๑๖
<?php $day_check = ”; while (have_posts()) : the_post(); $day = get_the_date(‘j’); if ($day != $day_check) { if ($day_check != ”) { echo ‘</ul>’; // close the list here } echo get_the_date() . ‘<ul>’; } ?> <li><a href=”#”><?php the_time(); ?><?php the_title(); ?></a></li> <?php $day_check = $day; endwhile; ?> do like this i hop this work
I think it’s better to use date_query as argument, like so : $query = new WP_Query( ‘year=2012&monthnum=12&day=12’ ); or: $args = array( ‘date_query’ => array( array( ‘year’ => 2012, ‘month’ => 12, ‘day’ => 12, ), ), ); $query = new WP_Query( $args ); Source : https://codex.wordpress.org/Class_Reference/WP_Query
Sort posts on custom field AND after that sort on date?
So I was first looking for a way to loop through the existing posts, as suggested in Christine’s comment. Based on this answer, I created a basic plugin that runs the loop upon activation. // Run the loop when the plugin is activated register_activation_hook(__FILE__, ‘update_my_metadata’); function update_my_metadata(){ $args = array( ‘post_type’ => ‘post’, // Only … Read more
Please use DateTime::getTimestamp() that returns unix timestamp. If you want to format the date according to your time zone then you try this. $datetime = new DateTime(“now”, new DateTimeZone(‘America/New York’)); echo $datetime ->format(‘m/d/Y, H:i:s’);
Timezone for Plugin