Hi!
I read this post about this matter in a single list, and it works fine. But I was wondering how it's possible to make several post-lists with the highlight-function.
the code to highlight the title of the post showing on the single-post-page:
<ul class="sidebar-ul">
<?php
$IDOutsideLoop = $post->ID;
global $post;
$myposts = get_posts('showposts=5');
foreach($myposts as $post) :
?>
<li <?php
if(is_single() && $IDOutsideLoop == $post->ID)
{
echo " class=\"current\"";
}
?>>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
I use this code to show multiple lists:
// FIRST LOOP: display posts 1 thru 5
<?php query_posts('showposts=5'); ?>
<?php $posts = get_posts('numberposts=5&offset=0'); foreach ($posts as $post) : start_wp(); ?>
<?php static $count1 = 0; if ($count1 == "5") { break; } else { ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php $count1++; } ?>
<?php endforeach; ?>
// SECOND LOOP: display posts 6 thru 10
<?php query_posts('showposts=5'); ?>
<?php $posts = get_posts('numberposts=5&offset=5'); foreach ($posts as $post) : start_wp(); ?>
<?php static $count2 = 0; if ($count2 == "5") { break; } else { ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php $count2++; } ?>
<?php endforeach; ?>