The loop doesn’t work on some pages
-
I have a loop:
<div id="custom"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php if (!in_category('3')) continue; ?> <?php the_content(); ?> <hr /> <?php endwhile; else: ?> <p><?php _e('No announcements'); ?></p> <?php endif; ?> test </div>
that shows only posts from category 3 (announcements) on this div with an id of “custom” that shows on top. This code is inserted into header.php
With index.php, archive.php, search.php I can see this BUT NOT with page.php or single.php. I dunno why since I can see <div id=”custom”> and </div> in the html.
And the test is to test if there’s anything wrong with the code. Apparently in index.php, archive.php and search.php I can see the announcement, followed by a hr and a test.
Whereas for the rest I can see a test only.
Help.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘The loop doesn’t work on some pages’ is closed to new replies.