372 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Sold between 1 000 and 5 000 dollars
  • Sweden
mrjasmin says

Hi! I´m having a little problem with my wordpress theme. I want to use query_posts on my theme, but when I add query_posts before the loop, than the page gets all white and everuthing on the page disappears. Everything else works just fine on the theme before i add the query_posts.

How do i solve this problem ?

Here is my code :

http://pastie.org/441664

372 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Sold between 1 000 and 5 000 dollars
  • Sweden
mrjasmin says

Nobody ?

204 posts Bold WordPress Theme Development
  • Bought between 1 and 9 items
  • Elite Author
  • Europe
  • Exclusive Author
  • Has been a member for 5-6 years
  • Interviewed on the Envato Notes blog
  • Referred between 200 and 499 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+1 more
srhnbr says

Try having the ‘if have posts’ first then ‘query posts’ then ‘while have posts’ and be careful with how you end your loop.

So you’ll have:

if..

query..
while...
endwhile...

else..

endif

hope that makes sense

372 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Sold between 1 000 and 5 000 dollars
  • Sweden
mrjasmin says
Try having the ‘if have posts’ first then ‘query posts’ then ‘while have posts’ and be careful with how you end your loop.

So you’ll have:

if..

query..
while...
endwhile...

else..

endif

hope that makes sense

Still not working….

171 posts
  • Sold between 10 000 and 50 000 dollars
  • Referred between 100 and 199 users
  • Bought between 100 and 499 items
  • Has been a member for 5-6 years
  • Exclusive Author
  • United States
clarklab says

When you use query_posts it affects the loops that come after it. You need to preserve the original loop if you still want to use it. Look up info about rewind_posts(), that should help…

372 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Sold between 1 000 and 5 000 dollars
  • Sweden
mrjasmin says

Still not working, i will pay the one who helps me solve the problem.

171 posts
  • Sold between 10 000 and 50 000 dollars
  • Referred between 100 and 199 users
  • Bought between 100 and 499 items
  • Has been a member for 5-6 years
  • Exclusive Author
  • United States
clarklab says

Oh, I read that wrong. I thought you meant the query_posts was working but ruining the rest of the page.

Here is the exact snippet from my template that shows how I do it. I don’t have time to troubleshoot your code, but if you compare it to this you should be able to find the problem:

http://pastie.org/441977

(it looks like you dont both need IF have post and WHILE have posts)

255 posts
  • Bought between 10 and 49 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 5-6 years
  • Sold between 250 000 and 1 000 000 dollars
  • United States
BuchmannDesign says

The end of your code looks unusual:

<? endelse <?php endif ; ?>

First, you don’t have a closing php code after “endelse”.

Second, i have issues with php code if i use ”<?” instead of ”<?php”. Try using ”<?php” before the endelse.

I charge $1000.00 per incident! :)

372 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Sold between 1 000 and 5 000 dollars
  • Sweden
mrjasmin says

It´s not working. Is there anybode that can help me ? That can take a look in my files ? I will pay 10 $.

372 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Sold between 1 000 and 5 000 dollars
  • Sweden
mrjasmin says

Anyone ? I will pay.

by
by
by
by
by
by