WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Query Posts wrecking the template hierarchy?

[Resolved] Query Posts wrecking the template hierarchy?

  • Cathy Tibbles

    @multitalentedmommy

    I have this http://pastebin.com/m1450fff6 in my header. and it
    is effecting which posts are queried in all templates.
    I cannot move it out of the header position, and would like it to display on all pages.

    Is there a way to go back to the regular post queries after this code is ‘finished’?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    Change it to a new WP_Query instead, so that you don’t affect the default one.

    See http://pastebin.com/md59e786

    Cathy Tibbles

    @multitalentedmommy

    I’m getting a syntax error. I’ve checked the syntax the best I know how. But it doesn’t like the last line of the code – <php endif;?>.

    I wish I could understand more of what this code is doing. I got the wordpress tags, but as soon as it goes into php & wp queries, I get lost! So I can’t even tell if the code isn’t running a normal loop? It doesn’t want to end the loop? No idea.

    Thanks for any help. 🙂

    Cathy Tibbles

    @multitalentedmommy

    problem solved. Removed the endif. I suppose its not a loop or er something. lol

    thanks for the awesome code, Otto!

    Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    Actually, I left out a colon. 🙂

    Here’s the fixed code:
    http://pastebin.com/md59e786

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Query Posts wrecking the template hierarchy?’ is closed to new replies.