different for loop if screen resolution < 1000px

query_posts is a PHP function, not a javascript function, it’s executed on the server, and the resulting output is sent to the browser. By the time the browser gets the chance to run your if( $(window).width() < 2000 ) { check, it’s already too late. The server has finished its PHP script, sent it across, … Read more

WP Query crashes on more than ~ 2000 posts

Querying this many posts is dangerous and you can ( and do ) take the site down. If you absolutely have to do this, you need to adjust your query to be more performant. If you’re just needing the link then add ‘fields’ => ‘ids’ to your params – this will only return the post … Read more

Transients with dynamic WP_Query

I have read quite a few of your posts and it seems like your queries are really complex which either slows the page or simply crashes it. Transients are definitely an option to store the results of such labor intensive queries. As @s_ha_dum mentioned, you’ll need to look into what you will be saving. Would … Read more

WP_Query results stored in variables

From what I read, you read the URL/path to the post thumbnails is an array. We need to look at a couple of things here to make this as lean and predictable as possible IMPORTANT CONSIDERATIONS We do need some way to make sure that we get the latest three posts which actually have thumbnails … Read more

WP_Query with rewind_posts creates duplicate titles

You have a couple of issues here You are checking whether the main query returned any posts and then loop through the posts of your custom query rewind_posts() is wrongly used. By default, rewind_posts() rewinds the loop of the main query. You should rewind the posts of your custom query. Your last loop just basically … Read more