php code in the loop
-
If I’m in a category I want to start a
<ul>
and then the Loop. In the Loop I output some<li>
‘s and the_excerpt(). Right after that I close the Loop.Else: If I’m not in a category output the_content().
<?php if ( is_category() ) { ?> <ul> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <li>Text in li that will be repeated @the loop</li> <?php the_excerpt(); ?> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?> </ul> <?php } else { the_content(); } ?>
What worx: When I’m on a category everything is fine, the Text and the_excerpt() are shown But when I click on a post, there is no content! Only the Header and Footer are shown but the_content() disappears. Is my else statement not correct?
Can anybody help me to make this code work?
Thank you!
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘php code in the loop’ is closed to new replies.