Conditionals in WP_Query

You can simplify things by using the date_query of WP_Query(), instead of the posts_where filter. You can then try the following (untested): // Fetch from the ‘featured’ category $args = array( ‘posts_per_page’ => 1, ‘category_name’ => ‘featured’, ‘date_query’ => array( array( ‘after’ => ‘1 week ago’ ) ), ); $the_query = new WP_Query( $args ); … Read more

Not duplicating $post->ID leaves empty space.

I don’t think your code does what you think, as it is only ever set to a single post from one of your loops. You description doesn’t really match that logic. To prevent duplicates you need to accumulate an array of IDs with each Loop. $do_not_duplicate[] = $post->ID; I think the space you are seeing … Read more

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