WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#9940 closed defect (bug) (invalid)

Conditional tags can't to be used after a loop

Reported by: csseur3 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Template Keywords: loop, tags
Focuses: Cc:

Description

Hello,

there is a classic loop:

<?php if (have_posts()) : ?>
      <?php query_posts('orderby=category&order=asc&cat=133'); ?>
      <?php while (have_posts()) : the_post(); ?>

      codes etc...

      <?php endwhile; ?>
      <?php endif; ?>

with the pages where i have a loop, all my conditional tags in the footer.php doesn't work, but the conditional tags in header.php works...

So, it is impossible to use conditional tags after a loop?

Change History (4)

comment:1 filosofo5 years ago

  • Milestone 2.8 deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 2.7.1 deleted

It depends which conditional "tags" you have in mind.

You can read about the Loop or get WordPress help, but you have not described a bug in WordPress.

comment:2 Denis-de-Bernardy5 years ago

this is actually a dup of #9458, which I closed as dup from another ticket since the key issues have been fixed, but which still isn't fixed, technically.

comment:3 csseur35 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

For example, i have a page with ID 100, and there is a loop in this page.

I make two codes in header.php and footer.php to be visible only on this page of ID 100:

<?php if ( is_page('100')) { ?>blablabla blablabla<?php } ?>

it works with header.php, not with footer.php ... why?

bye

"You can read about the Loop or get WordPress help, but you have not described a bug in WordPress. " -> i know the loop and nobody has found solution for the problem in my topics :)

comment:4 Denis-de-Bernardy5 years ago

  • Resolution set to invalid
  • Status changed from reopened to closed

use wp_reset_query()

Note: See TracTickets for help on using tickets.