Date query year and month OR just year

You have not stated how the selection works, but you need to have some kind of conditional set when a specific month is selected and when a year archive is selected. I also do not know where get_the_time comes in or its relevance to the query. But anyways, there are some other really big issues … Read more

Add to previous posts under post

Try to add date_query to the $qry in the solution mentioned here. $qry = new WP_Query( array( ‘cat’ => $current_post_categories[0], ‘posts_per_page’ => 2, ‘post__not_in’ => array( $current_post_id ), ‘date_query’ => array( array( ‘before’ => $post->post_date, ), ), ));

Date Query to Pull Current and Future Posts

I wonder if you mean this kind of date_query: $query->set( ‘date_query’, [ [ ‘after’ => ‘today midnight’, ‘column’ => ‘post_date_gmt’, ‘inclusive’ => true, ], ] ); where we use the after attribute. Here the after date will be calculated by WP_Date_Query as: gmdate( ‘Y-m-d H:i:s’, strtotime( ‘today midnight’, current_time( ‘timestamp’ ) ) ); With the … Read more

Get only modified posts

You can use the posts_where filter: // Add custom filter add_filter( ‘posts_where’, ‘wpse_modified’ ); // Fetch posts $query = new WP_Query( $lastupdated_args ); where you can define the filter callback as: function wpse_modified( $where ) { global $wpdb; // Run only once: remove_filter( current_filter(), __FUNCTION__ ); // Append custom SQL return $where . ” AND … Read more

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