[wp-hackers] Needed: More Elegant Solution for Using another "the loop"

Mark Shields laebshade at gmail.com
Sun Oct 10 19:36:33 UTC 2004


Currently working on a Breadcrumb navigation plugin version compatible
with WP 1.3.  It is nearly ready for a new release, though I may hold
off until there's an official release of WP 1.3.  But I digress.  I
use the following code placed in index.php:

<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
<?php 
$postcount += 1;
if ($postcount == 1) { 
	get_breadcrumb(0, 1, 1, 1);
	if ($showRoot || $m || $author || $s || $cat) {
		echo "<br />";
	}
}
?>
<?php endforeach; else: ?>
<?php endif; ?>

Ignore the second if statement, that's just something I use for my
website.  Also ignore the breadcrumb() function call as it is needed. 
I'd like a more elegant block of code (re: easier/smaller to put it
the index.php file) than that.   I've
attempted to put "the loop" code into the plugin file, but it seems to
disrupt the original "the loop" processing (call the loop twice works
fine in the index.php file).  Any suggestions on the best way to
complete this with minimal code?
-- 
- Mark Shields



More information about the hackers mailing list