I have this custom chunk of code with multiple loops. Can it be improved? Is the wp reset query used correctly? I was thinking maybe to many requests on the home page possibly…
The server I have my site on always randomly crashes – doesnt matter if its got 500 visits a day or 50,000. I dont know if its this chunk of code or the vps im running on. My server looks fine as far as usage, nothing in the logs that shows me anything….
Here is a pastebin link, thanks for any time looking at this – Claytonhttp://pastebin.com/j0yaRhte
does anyone think the code could be improved or is it just my server quality?
It could definitely be improved. One of the things you should always avoid doing is calling query_posts() more than once. The query_posts() function is actually a really expensive function and should not be used except in rare cases. It’s much better to use WP_Query. See the revised code below:http://pastebin.com/cCGgcWuM
could the way I have been doing it cause a strain on the server? Thanks for your help, I am going to implement it and see how things go.
Strain to the point of breaking? Very unlikely. Unnecessary strain, yes.
I copied over the code, it wouldnt work strait up. I am trying to see what I need to change as we speak…