Prblems in advanced loop customizing
-
Hi all,
I use this loop for displaying the last posted item as the “featured” item (without using a special category for featured), and then all other items in regular order.
This is the code, which is working very well:<?php if (have_posts() ) { // if is 1st item on home page $count = 0; while (have_posts()) : the_post(); if (is_front_page() && !is_paged() && ($count == 0) ) { ?> <div class="mainitem"> some code for the main item </div> <?php $count++ ?> <?php } else { // all other items ?> <div class="regular-item"> some code for showing other items </div> <?php } endwhile; ?> <?php } ?> <!-- End items -->Now, I want to have some categories excluded from the loop, and to show them in the sidebar. Suppose I want to exclude category id #19, I tried to add
if (in_category(19)) continue;
but then I’ve got weired things happening, such as displaying only 1 item per page, or haveing the 1st page empty and items only starting at page 2.I’m desparated here, trying for hours to find a good syntax and way to do that exclusion. What am I doing wrong in here?
Or maybe the whole of my loop concept is wrong, and I should not use this way to display the featured/last post ?
The topic ‘Prblems in advanced loop customizing’ is closed to new replies.