372 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
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
  • Has been part of the Envato Community for over 5 years
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
mrjasmin says

Nobody ?

204 posts Bold WordPress Theme Development
  • Has been part of the Envato Community for over 6 years
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Interviewed on an Envato blog
+5 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
  • Has been part of the Envato Community for over 5 years
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
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
  • Has referred 100+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Had an item featured on Envato Market
+4 more
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
  • Has been part of the Envato Community for over 5 years
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
mrjasmin says

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

171 posts
  • Has referred 100+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Had an item featured on Envato Market
+4 more
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)

258 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+4 more
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
  • Has been part of the Envato Community for over 5 years
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
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
  • Has been part of the Envato Community for over 5 years
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
mrjasmin says

Anyone ? I will pay.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by