<div id="sidebar"><ul class="inner">
<?php global $fauna; // Register Fauna options ?>
<?php /* Sidenotes */
/* Guess Sidenotes category */
$sidenote_cat = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = 'sidenotes'");
if(is_home() && $sidenote_cat != "") {
query_posts("cat=".$sidenote_cat."&showposts=".$posts_per_page); /* Grab sidenotes */
?>
<li>
<h4><?php _e('Sidenotes'); ?></h4>
<a href="<?php echo get_category_rss_link(0, $sidenote_cat, $post->cat_name); ?>" title="<?php _e('Syndicate Sidenotes using RSS 2.0','fauna') ?>">
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/feed.png" alt="Feed" class="feedicon" /></a>
<?php rewind_posts(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php include (TEMPLATEPATH . '/template-sidenote.php'); ?>
<?php endwhile; endif; ?>
<?php rewind_posts(); query_posts("showposts=".$posts_per_page); /* Confused? Don't be. This line just resets the hack above so all is normal again. */ ?>
</li>
<?php } ?>
<?php /* Category Meta */ if (is_category()) { ?>
<li>
<h4><?php _e('Category:','fauna'); ?> <?php single_cat_title('', 'display'); ?></h4>
<a href="<?php echo get_category_rss_link(0, $cat, $post->cat_name); ?>" title="<?php printf(__('Syndicate %s using RSS 2.0','fauna'), $post->cat_name) ?>"><img class="feedicon" src="<?php bloginfo('stylesheet_directory'); ?>/images/feed.png" alt="<?php _e('Feed','fauna'); ?>" /></a>
<p><?php echo category_description(); ?></p>
</li>
<?php } ?>
<?php /* Category List */ if (is_category() || is_page("archives") || is_date() || $fauna->option['show_categories'] == true) { ?>
<?php /* Guess special categories */
$noteworthy_cat = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = 'noteworthy'");
$sidenote_cat = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = 'sidenotes'");
$asides_cat = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = 'asides' OR category_nicename = 'dailies'");
?>
<li id="categorylist">
<h4><?php _e('Categories','fauna'); ?></h4>
<ul>
<?php $feed = get_bloginfo('stylesheet_directory') . "/images/feed-small.png";
wswwpx_fold_category_list("children=1&hide_empty=0&sort_column=name&optioncount=1&feed_image=".$feed."&exclude=".$sidenote_cat.",".$asides_cat.",".$noteworthy_cat." '") ?>
</ul>
<?php if ($noteworthy_cat != "" || $sidenote_cat != "") { ?>
<h4><?php _e('Special Categories','fauna'); ?></h4>
<ul>
<?php if ($sidenote_cat != "") { ?><li><?php echo(get_category_parents($sidenote_cat,TRUE,'')); ?>
<a href="<?php echo get_category_rss_link(0, $sidenote_cat, $post->cat_name); ?>" title="<?php _e('Syndicate Sidenotes using RSS 2.0','fauna') ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/feed-small.png" alt="<?php _e('Feed','fauna'); ?>" /></a>
(<?php echo count($wpdb->get_col("SELECT rel_id FROM $wpdb->post2cat WHERE category_id = $sidenote_cat;")); ?>)
</li><?php } ?>
<?php if ($asides_cat != "") { ?><li><?php echo(get_category_parents($asides_cat,TRUE,'')); ?>
<a href="<?php echo get_category_rss_link(0, $asides_cat, $post->cat_name); ?>" title="<?php _e('Syndicate Asides using RSS 2.0','fauna') ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/feed-small.png" alt="<?php _e('Feed','fauna'); ?>" /></a>
(<?php echo count($wpdb->get_col("SELECT rel_id FROM $wpdb->post2cat WHERE category_id = $asides_cat;")); ?>)
</li><?php } ?>
<?php if ($noteworthy_cat != "") { ?><li><?php echo(get_category_parents($noteworthy_cat,TRUE,'')); ?>
<a href="<?php echo get_category_rss_link(0, $noteworthy_cat, $post->cat_name); ?>" title="<?php _e('Syndicate Noteworthy using RSS 2.0','fauna') ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/feed-small.png" alt="<?php _e('Feed','fauna'); ?>" /></a>
(<?php echo count($wpdb->get_col("SELECT rel_id FROM $wpdb->post2cat WHERE category_id = $noteworthy_cat;")); ?>)
</li><?php } ?>
</ul>
<?php } ?>
</li>
<?php } ?>
<?php /* Begin "If Widgets" */ if (is_home() || is_single() ) { if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
<?php /* Calendar, Links, Meta */ if (is_home() && $fauna->option['show_calendar']) { ?>
<li>
<h4><?php _e('Calendar','fauna'); ?></h4>
<?php get_calendar(); ?>
</li>
<?php } ?>
<?php if (is_home()) { if ($fauna->option['show_links'] || $fauna->option['show_meta']) { ?>
<li>
<?php if ($fauna->option['show_links']) { ?>
<h4><?php _e('Links','fauna'); ?></h4>
<ul>
<?php get_links(-1,'<li>» ','</li>','\n',0,'updated',0,0,200,0); ?>
</ul>
<?php } ?>
<?php if ($fauna->option['show_meta']) { ?>
<h4><?php _e('Meta','fauna'); ?></h4>
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<?php wp_meta(); ?>
</ul>
<?php } ?>
</li>
<?php } } ?>
<?php /* End "If Widgets" */ endif; } ?>
<?php /* Single Post Archive Meta */ if(is_single()) { ?>
<li>
<h4><?php _e('This Entry','fauna'); ?></h4>
<?php comments_rss_link('<img src="' . get_bloginfo('stylesheet_directory') .'/images/feed.png" alt="' . __('Feed','fauna') . '" class="feedicon" />'); ?>
<?php rewind_posts(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<p><?php printf(__('<a href="%1$s" title="Permanent Link: %2$s">"%3$s"</a> was written %4$s by %5$s and filed under %6$s.','fauna'), get_permalink(), get_the_title(), get_the_title(), get_the_time(), get_the_author_posts_link(), get_the_category_list(', ')); ?></p>
<?php if (function_exists('UTW_ShowTagsForCurrentPost')) { ?>
<?php _e('Tagged:','fauna');; ?> <?php UTW_ShowTagsForCurrentPost("commalist");
} ?>
<?php endwhile; endif; ?>
<?php rewind_posts(); ?>
<?php include (TEMPLATEPATH . '/template-commentmeta.php'); ?>
<?php rewind_posts(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php if (get_post_custom_values('sidebar') != "") { ?>
<?php echo c2c_get_custom('sidebar'); ?>
<?php } ?>
<?php endwhile; endif; ?>
<?php rewind_posts(); ?>
</li>
<?php } ?>
<?php /* Search Meta */ if(is_search()) { ?>
<li>
<h4><?php _e('Search','fauna'); ?></h4>
<p><?php _e('All keywords are searched for.','fauna'); ?></p>
</li>
<?php } ?>
<?php /* Archive Meta */ if (is_page("archives")) { ?>
<li>
<h4><?php _e('Archives','fauna'); ?></h4>
<p><?php printf(__('You are viewing the archives for %s. ','fauna'), get_bloginfo('name')) ?></p>
<?php
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts);
$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
if (0 < $numcomms) $numcomms = number_format($numcomms);
$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
if (0 < $numcats) $numcats = number_format($numcats);
?>
<p><?php printf(__('There are currently %1$s posts and %2$s comments, contained within %3$s categories.','fauna'), $numposts, $numcomms, $numcats) ?></p>
</li>
<?php } ?>
<?php /* Author Meta */ if (is_author()) { ?>
<?php $num_authors = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->users"); ?>
<li>
<h4><?php _e('Author Archive','fauna'); ?></h4>
<p><?php _e('This page details authors of this weblog.','fauna'); ?></p>
<?php /* Fix an annoying WP bug where wp_list_authors borks when there's only one user */
$numauthors = $wpdb->get_results("SELECT COUNT(*) FROM $wpdb->users");
if (count($numauthors) > 1) { ?>
<p><?php printf(__('There are %s authors/users attached to this weblog:','fauna'), $num_authors) ?></p>
<ul>
<?php wp_list_authors('optioncount=1&feed=RSS'); ?>
</ul>
<?php } else { ?>
<p><?php _e('There is one author attached to this weblog.','fauna'); ?></p>
<?php } ?>
</li>
<?php } ?>
<?php /* Pages */ if (is_page() && !is_page('archives') && !is_page('tag-search')) { ?>
<li>
<?php
$currentpage = $post->ID;
$parent = 1;
while($parent) {
$subpages = $wpdb->get_row("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = '$currentpage'");
$parent = $currentpage = $subpages->post_parent;
}
$parent_id = $subpages->ID;
$haschildren = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '$parent_id'");
$parent_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = '$parent_id'");
?>
<?php rewind_posts(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h4>
<?php global $post;
echo '<a href="' . apply_filters( 'the_permalink', get_permalink($parent_id) ) . '">' . apply_filters( 'the_title', $parent_title ) . '</a>';
?>
</h4>
<?php endwhile; endif; ?>
<?php rewind_posts(); ?>
<?php if($haschildren) { ?>
<ul>
<?php wp_list_pages('title_li=&child_of='. $parent_id); ?>
</ul>
<?php } ?>
<?php include (TEMPLATEPATH . '/template-commentmeta.php'); ?>
<?php rewind_posts(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php if (get_post_custom_values('sidebar') != "") { ?>
<?php echo c2c_get_custom('sidebar'); ?>
<?php } ?>
<?php endwhile; endif; ?>
<?php rewind_posts(); ?>
</li>
<?php } ?>
</ul></div><!--// #sidebar -->
Alles anzeigen