I created a category-list to show them in a way, my accordion can use. (Custom in the sidebar) I want to add a class named "current" for the currently viewed post and the viewed category should be opened. Do you have any ideas to integrate this in the code? It was hard work to get this to work and now I dont know how to integrate it...
Link: http://www.davidgoltz.de/2011/anna-bederke-actor/ (after you click "Portfolio", the menu appears and should show the opened tree with a highlighted post.
Here is the code:
<div id="category-list">
<ul class="topnav">
<?php
$kategorien = get_categories(array(
'child_of' => 0,
'exclude_tree' => 15,
'exclude' => 16,
'orderby' => 'slug',
'order' => 'ASC'));
foreach($kategorien as $kategorie) {
echo '<li><a href="#" class="category-title">'; echo ($kategorie->name); echo '</a>';
echo '<ul>';
$cat = $kategorie->cat_ID;
$posts = get_posts('category='. $cat .'&posts_per_page=-1');
foreach($posts as $post) { ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<li>
<? }
echo '</ul>';
echo '</li>';
}
?>
</ul>
</div>