Advanced Custom Fields and date picker, show posts only if the day is today no matter the year

It’s a little complicated, but we can do this by directly modifying the query with a filter on posts_where. We’ll start with a query for posts with a meta value of today’s date, this is assuming a date format of yyyy-mm-dd: $date_today = date(‘Y-m-d’); $args = array( ‘posts_per_page’ => -1, ‘meta_query’ => array( array( ‘key’ … Read more

Date comparison : which date format?

The date format for entering the date is largely irrelevant. strtotime will convert a lot of different formats to UNIX time. Just make sure your input format makes sense to your users and make sure that your feed strtottime a format that correctly converts to UNIX time. If you are storing data in the *_postmeta … Read more

check if a draft has been moved there from publish to draft

As far as I can see, you won’t get any indication a post was previously published, as wordpress remembers only the old versus new transitions. I recommend you add some meta data, that is use add_action(‘publish_post’, ‘your_function’) (or similar) to do update_post_meta($post->ID, ‘post_published’, ‘on’). That way, every post gets an indicator when it’s published – … Read more

Posted date format not reflected

I found a workaround by myself. In wp-content/themes/twentythirteen/function.php: function twentythirteen_entry_date( $echo = true ) { : //$date = sprintf( ‘<span class=”date”><a href=”https://wordpress.stackexchange.com/questions/112514/%1$s” title=”%2$s” rel=”bookmark”><time class=”entry-date” datetime=”%3$s”>%4$s</time></a></span>’, $date = sprintf( ‘<span class=”date”><a href=”https://wordpress.stackexchange.com/questions/112514/%1$s” title=”%2$s” rel=”bookmark”><time class=”entry-date” datetime=”%3$s”>%3$s</time></a></span>’, x %4$s o %3$s Still, it doesn’t seem to reflect the choice of the date-format setting made on wp.

Set Custom Date for Posts

Yes you can put custom date by editing the published on date on the top right of the post/page edit. See the image attached for better understanding.

How to second orderby in “pre_get_posts” by meta value or combine single date and time to timestamp

I’m outlining a solution for what you asked in your last comment, because this wouldn’t been fitting for the comment format. Code: function date_time_to_timestamp_meta( $post_id ) { // meta fields are saved in DATETIME, e.g. »2013-12-09 22:32:12« // here is only the date part relevant $datetime_date = get_post_meta( $post_id, ‘_start_date’, true ); // here is … Read more

Change the date and time in wordpress

Maybe you’ld like to go to settings > general and then add a custom date format. Like d.m.1985 instead of d.m.Y Or you write a function that subtracts the time you want from the current date. Or you set the server time back to 1985. But that’s no good idea since it will affect other … Read more

automatic send email at custom time

Creating a Scheduled Event First we’ll create a function that will schedule our event. Mine is called “mycronjob” and it will run once every day. All this code can go into your plugin’s main file, outside the main function: // create a scheduled event (if it does not exist already) function cronstarter_activation() { if( !wp_next_scheduled( … Read more