How to show different timestamp

This should do it. // See if the post is older than 24 hours. if ( get_post_time() <= strtotime( ‘-1 day’ ) ) { echo ‘Published more than 24 hours ago.’; } else { echo ‘Published within the last 24 hours.’; }

Woocomerce pulling wrong time from server -5 hrs difference

For the date Woocommerce CODE function wc_string_to_datetime( $time_string ) { // Strings are defined in local WP timezone. Convert to UTC. if ( 1 === preg_match( ‘/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|((-|\+)\d{2}:\d{2}))$/’, $time_string, $date_bits ) ) { $offset = ! empty( $date_bits[7] ) ? iso8601_timezone_to_offset( $date_bits[7] ) : wc_timezone_offset(); $timestamp = gmmktime( $date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1] ) – … Read more

Query posts using less than

How about something like this? $args = array( ‘date_query’ => array( array( ‘before’ => array( ‘year’ => 2013, ‘month’ => 2, ‘day’ => 28, ), ‘inclusive’ => true, ), ), ‘posts_per_page’ => -1, ); $query = new WP_Query( $args ); Obviously you could set the exact date from a variable. More info: https://codex.wordpress.org/Class_Reference/WP_Query

tribe_get_start_time displays the current date and time on other post types than tribe_events

There are various ways to solve this. First coming to mind are checking via is_singular() or get_post_type(). Using the latter you could write foreach( $posts as $p ): setup_postdata( $p ); $post_type = get_post_type($p); if ($post_type === Tribe__Events__Main::POSTTYPE) { //or: if ($post_type === ‘tribe_events’) { // Display the date of the event $p_event = tribe_get_start_time … Read more

Compare meta key to current date in pre get post

What you’re trying isn’t possible with WP_Query. The reason is that because you have only stored the duration, it’s not possible to tell whether a post has expired until you know the publication date and the duration time and add them together. That’s what this does: $expire = get_field( ‘status_time_duration’ ) + get_the_time( ‘U’ ); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)