I see an option ([--post_date=<post_date>]) in wp-cli, but how can we use wp-cli to update all my published posts date randomly? For example, I want all posts date changed randomly between 01-01-2021 to 01-01-2022, how can I do this using cli?
I want to display dates in Hindi format like jan 10 using get_the_date() function. What I have tried so far: echo get_the_date(_e('F j')); which outputs: F jJanuary 10, 2017.
I am working on a wordpress post in which I want the date/time in frech format as shown below: ENGLISH By FJ Published April 9, 2019 at 4:05 p.m. Last updated April 9, 2019 at 4:14 p.m. FRENCH Un texte de FJ Publié le 9 avril 2019 à 16 h 05 Mis à jour le 9 avril 2019 à 16 h 14 I have used the following code to pull the date/time in english/french for wordpress post: <strong><?php if(ICL_LANGUAGE_CODE=='en'){ ?> …
Am I correct in understanding that the publish date and the modified date are actually the same thing under the covers in WP? We have a need to show “this article was last updated on”, which could be 2018 December. But the edit to put this date in our content could be done today, in April 2022. If we change the official modified date to be shown to the world (2018), by changing the publication date in WP, it doesn’t …
When I use this code the name of the day been writed with a small letter. get_the_time(strtotime($DateValue)), get_the_time('l d.m.Y H:i', $post) I want the name of the day looking like this: Monday, Sunday, Thursday etc. Now it look like this monday, sunday What do I do wrong ?
I have a need to display a time-of-day value in a site's chosen time format. For example I have 16:42:18 and want to display it as 4:42 PM if the time_format option is g:i A, or 16:42:18 if the time_format is H:i:s. I need this to render data captured by HTML5's <input type="time"> form field. How to do this?
Question How can I display only the Month and Year that a page was created? Background I have a page that will get changes has a field that shows the month and year. It needs to be in Month and year format like "December 2013" Code I previously had this in my template, to display (for example) December 2013: <time><?php the_time('F Y') ?>:</time> But since it will only show up on a specific page I wrote this <?php if ( …
I made a custom template of error 404 page. In my header.php i use the_time() function to display current date. There is some problem with 404 page because the_time() function won't work, not return any date. Why is that happen?
I can't find out the option of published date or modified date on my blog post. I write the this code <?php echo get_the_date() ?> but can't display the date. this is my blog post where I try to display the published or modified date. My website Link: www.applavia.com
I'd like to create an archive that lists posts under a month header. The months would just be plain text and the post titles, obviously, would link to the posts themselves! So: October 2013 Post title 1 Post title 2 September 2013 Post title 1 Post title 2 August 2013 Post title 1 Post title 2 . . . and, if possible, only show one year per page! So, uhhh, I guess it's paginated too. Is this possible? Probably. I've …
I have a custom field "DOB" on my custom post type which is in [Ymd] format. I want to compare that date of birth to current time and want to show "You are # years # months." I am able to calculate Years only but it is not accurate. Help me.
The scenario is to run insert_post function every midnight (00:00) of local time. Must run daily on weekday. function add_daily_task(){ if((date('l', time()) != 'Saturday') || (date('l', time()) != 'Sunday')){ // insert post } } if(!wp_next_scheduled( 'add_daily_task_schedule')){ wp_schedule_event(time(), 'daily', 'add_daily_task_schedule'); // how should change time() to meet my local schedule? } add_action('add_daily_task_schedule', 'add_daily_task');
I was showing publish and update date together, but I'm trying to do it like this, hide the publish date if there is an update date <time datetime="<?php the_modified_time( 'c' ); ?>"> • Update Date: <?php the_modified_time( 'j F Y - H:i' ); ?> </time> <time datetime="<?php the_time( 'c' ); ?>"> • Publish Date: <?php the_time( 'j F Y - H:i' ); ?> </time> how can i do it using 'else if'
My local WordPress installation on XAMPP seems to have a wrong time setting. When I do date( 'Y-m-d H:i:s' ); I get 2017-02-21 10:46:43 as result. However my PCs time really is 2017-02-21 11:46:43, so my WordPress is one hour behind. Now I already did, what was recommended here and changed date.timezone in the php.ini to my timezone and restarted the apache afterwards, since I thought the problem might be cause by XAMPP. But still I get the wrong time …
I have WordPress set to Los Angles time in Settings > General. In my database I have a DATETIME column. When I use $dt = DateTime::createFromFormat('Y-m-d H:i:s', $value_from_db); and then $dt->format('n/j/y @ g:iA T'); it displays the timezone as "UTC". In functions.php if I add date_default_timezone_set( get_option('timezone_string') ); then $dt will output correctly with "PST". It works, but I didn't think I needed to explicitly set the timezone since I already set it in WordPress. Am I doing something wrong …
I need a way to inform visitors if the post published date or modified date is older than 1 year and if so, display a message on the post page. I have added an code to my content-single.php file, but without the desired results in terms of checking against both published and updated time. Example: if (strtotime($post->post_date) < strtotime('-1 year')){ echo 'Old Post'; } else { echo 'Not Old Post'; } Any ideas as I'm in the dark here..
I have to make a custom plugin for a WordPress website. In this plugin, I have to create a meta box for a post where I have a time and date field that decides that when the post will be expired and will be moved in the trash. but the problem is that website has 2 admins situated in two different time zones. One admin is in GMT+2 and one admin is in GMT+4 and the webserver is running according …
/** * Add a Formatted Date to the WordPress REST API JSON Post Object * */ add_action('rest_api_init', function() { register_rest_field( array('comment'), 'formatted_date', array( 'get_callback' => function() { return get_the_date(); }, 'update_callback' => null, 'schema' => null, ) ); }); This is not working for me. I am constantly getting the following in my JSON: "formatted_date":false," How can I show it in a format like: "28 November 2021, 15:00"?