Comparing two dates (ACF and current time)
Comparing two dates (ACF and current time)
Comparing two dates (ACF and current time)
Compare time value in WP_User_Query for sending emails
What the current code does human_time_diff( get_the_time( ‘U’ ), current_time( ‘timestamp’ ) ) produces the time between when the post is published and the current time as a human readable string such as ‘6 days’. Meanwhile, strtotime( ‘7 days’ ) retrieves a integer timestamp representing 7 days after this moment, e.g. 1625673951. With that in … Read more
the_time() doesn’t return the current time, it returns the time of the current post, also it echoes the result. If you need the current time, simply use PHPs native time() function.
If building a multipurposetheme (Hello Themeforest!), I would always use a Custom Post Type for something like this. The reason is, as you already mentioned in your shortcode approach, you have too many fields and variables even in the beginning. Then, to have your Theme serve as many customers as possible, you have to add … Read more
Did you chceck the Codex Date Parameters ? Expecially the ‘before’ param.It works like this: $date = get_the_date(‘Y-m-d H:i:s’); $args = array( ‘date_query’ => array( array( ‘before’ => $date ), ), ‘posts_per_page’ => 10, ); $query = new WP_Query( $args );
The 2nd part of the condition seems wrong basename( get_permalink() != ‘sponsor-one’) should be basename( get_permalink() ) != ‘sponsor-one’ Please check where the parenthesis ends. Also in your code if that is the only condition, then you can have an else statement instead of having another elseif.
Add data-post_id attribute to checkbox and fill it with corresponding post ID. On click on compare button (link) retrieve all post ids from checked checkboxes with JavaScript (jQuery) Redirect to the comparision page with post IDs in url as GET parameters. This is just one scenario how your task could be done. PS your question … Read more
instead of $currentdate = current_time(‘Ymd’); you can use $currentdate = new DateTime(); so the Final Solution should be as like given below <?php $currentdate = new DateTime(); $date = get_field(‘course_start_date’, false, false); $date = new DateTime($date); if ($currentdate > $date) { echo ‘ – Started.’; } else { echo ‘ – Not started.’; } ?>
This part is incorrect: if ( is_single() && ! ‘wpdmpro’ == get_post_type() ) That essentially means: if ( is_single() && false == get_post_type() ) { Which will never be true. To check if a value does not equal another value, use !==: if ( is_single() && ‘wpdmpro’ !== get_post_type() ) Also, the way you’ve combined … Read more