The loop always loops even if condition is not met
-
Not sure if the title describes my problem.
I’m trying to make a custom frontpage for my site. The frontpage includes a slideshow while the rest of the site doesn’t.
Fot this i work with a conditional statement:
?php if(is_home()) { ?> <div id="welcome"> <h1>...</h1> slideshow </div> <div id="clear"></div> <?php } else {?> <div id="content"> <?php get_template_part( 'loop', 'index' );?> <?php get_sidebar(); ?> </div> <?php } ?>
When i’m on the frontpage everything works fine. When i click a link the loop does the job. But the styling doesn’t work. When i use firebug to view the code the content div isn’t used so no styling is applied.
When i delete the else statement, the result is the same. So with
<?php get_template_part( 'loop', 'index' );?> <?php get_sidebar(); ?>
removed, the loop still works. Why is this? I always thought get_template_part called the loop
- The topic ‘The loop always loops even if condition is not met’ is closed to new replies.