I’m afraid i’m not getting anything from this article… I’ve tried clearing the post cache before breadcrumb(); but it doesn’t seem to do anything. There has to be a way to get breadcrumb(); to work properly.
Let me show you what loops I’m using, paraphrased:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
<?php endwhile; endif; ?>
Loop2:
<?php query_posts('cat=3'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_date('','<div class="urgentdate">','</div>'); ?>
<?php the_content(__('»<span> </span>')); ?>
<?php endwhile; endif; ?>
Loop3:
<?php query_posts('cat=4'); ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_excerpt_reloaded('100','<strong><img>'); ?>
<?php endwhile; ?>
…and in this order everything works (but if the first loop is last then it doesn’t work because the query_posts() don’t clear. And then there’s this:
<?php breadcrumb(); ?>
And this breadcrumb doesn’t work because of the query_posts() from the other loops. There has to be a way to reset this. It seemed like the multiple loops in that codex didn’t apply to this situation. Anyone?
Just before you call your breadcrumb thingy, do this:
query_posts($query_string);
That will reset the query back to the same one as you had before any loop.
This recent topic hits on the same issue:
http://wordpress.org/support/topic/91067
Basically, to avoid whacking the default posts object on a page, avoid use of query_posts() (which is best used to reset the default posts loop) and go with creating a new WP_Query instance, so that:
Loop 2 starts:
<?php $cat_query = new WP_Query('cat=3'); ?>
<?php if ($cat_query->have_posts()) : while ($cat_query->have_posts()) : $cat_query->the_post(); ?>
Loop 3 starts:
<?php $cat_query = new WP_Query('cat=4'); ?>
<?php if ($cat_query->have_posts()) : while ($cat_query->have_posts()) : $cat_query->the_post(); ?>
Thank you very much, but these solutions didn’t work for the breadcrumb.
I’ll tell you what did work, in case anyone wants to know:
If you need to put a breadcrumb in the footer but the loops that precede it screw it up, call the breadcrumb once in the header, in a display:none div, then call it again at the footer. It seems to remember the results it extracted from the top.