WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Query Posts wrecking the template hierarchy? (5 posts)

  1. Cathy Tibbles
    Member
    Posted 5 years ago #

    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'?

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

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

    See http://pastebin.com/md59e786

  3. Cathy Tibbles
    Member
    Posted 5 years ago #

    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. :)

  4. Cathy Tibbles
    Member
    Posted 5 years ago #

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

    thanks for the awesome code, Otto!

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Actually, I left out a colon. :)

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

Topic Closed

This topic has been closed to new replies.

About this Topic