How do I display a date correctly that is stored in the database as a backwards 8 digit number from Advanced Custom Fields? [closed]

I voted to close your question, because it is pretty much a PHP problem, not a WordPress one and thus off topic on here. Nonetheless here comes some help. General information about Formatting Date and Time from the WordPress codex you might find helpful. Aside from that, on the PHP side of things, the date … Read more

How to display a WordPress Custom Field only on a specific day of the week?

You are not checking the current date correctly. You need to use current_time() funciton to get current datetime according to WordPress configuration. Then, using PHP date() you can check what day of week current date is: // Get current date time of WordPress in Unix timestamp format $timestamp = current_time( ‘timestamp’ ); // Get day … Read more

Ordering posts by custom field and grouped by month

<?php $period = date(“Y-m-d”); $args = array( ‘post_type’=>’event’, ‘posts_per_page’=> -1, ‘order’=> ‘DESC’, ‘orderby’=> ‘meta_value’, ‘meta_key’=>’event_start_date’ ‘meta_value’ => $period, ) $events = new WP_Query( $args ); if ($events->have_posts()) : while (have_posts()) : the_post(); the_title(); // (etc.) endwhile; endif; ?> Please follow below link for details. Link for details link for code source Thanks!

Get previous posts list

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 );

Convert all dates stored in custom field

Find the correct key for game_date_key and run this once: global $wpdb; $posts = $wpdb->get_results(“SELECT ID FROM “.$wpdb->prefix.”posts” WHERE post_type=”post”); foreach ($posts as $post) { $old_date = get_post_meta($post->ID,’game_date_key’,true); $new_date = date(‘d/m/Y’, strtotime($old_date)); update_post_meta($post->ID,’game_date_key’,$new_date,$old_date); } (I assume you will have the sense to backup your database first just in case. 🙂

Auto update post title and slug when post status is changed

I think I found the solution: add_filter(‘wp_insert_post_data’,’reset_post_date’,99,2); function reset_post_date($data,$postarr) { //update post time on status change $data[‘post_date’] = $data[‘post_modified’]; $data[‘post_date_gmt’] = $data[‘post_modified_gmt’]; //also update title and add the current date to title $data[‘post_title’] = ‘Your Default Title – ‘. current_time ( ‘m-d-Y’ ); //also update the slug of the post for the URL $data[‘post_name’] = … Read more

Add “Posted on” to post date

The post date is added by twentyfourteen_posted_on as shown in content.php. This function is in /inc/template-tags.php and is correctly wrapped in an if ( ! function_exists( ‘twentyfourteen_posted_on’ ) ) conditional so you can declare the same function in your child theme and modify it to your heart’s content. As such you could add a function … Read more

wordpress meta value compare between two date

After some research on wp codex I found my solution. Here I have to change birth_date format during save. I saved value like yy-mm-dd this format and changed my meta_query Here is the code $studentdata = get_users( array( ‘meta_query’=> array( array( ‘key’ => ‘birth_date’, ‘value’ => array( $startyear.’-01-01′,$endyear.’-12-31′), ‘compare’ => ‘BETWEEN’, ) ), ‘role’=>’student’ ) … Read more

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