function widget($args = array(), $defaults)
    {
        extract($args);
        global $post, $digressit_options;
        $currentpost = $post;
        if ($defaults['categorize']) {
            $categories = get_categories();
        } else {
            $categories = array('1');
        }
        ?>
        <div id="digress-it-list-posts">
        <a href="<?php 
        echo get_option('siteurl');
        ?>
">
            <div class="rule-dashboard">
                <div class="rule-home-text">
                    <?php 
        echo $defaults['title'];
        ?>
                </div>
            </div>
        </a>
        
        <div class="sidebar-optional-graphic"></div>
        <div class="sidebar-pullout"></div>

        <?php 
        $section_number = 1;
        foreach ($categories as $key => $cat) {
            if (isset($cat->name) && $cat->name == 'Uncategorized') {
                //continue;
            }
            ?>

            <?php 
            $cat_id = null;
            ?>
            <?php 
            if (isset($cat->name)) {
                ?>
            <h3><?php 
                echo $cat->name;
                ?>
</h3>
            <?php 
                $cat_id = $cat->cat_ID;
                ?>
            <?php 
            }
            ?>
            
            <?php 
            $args = array('numberposts' => -1, 'post_type' => 'post', 'post_status' => 'publish', 'post_type' => 'post', 'order_by' => $digressit_options['front_page_order_by'], 'order' => $digressit_options['front_page_order'], 'category' => $cat_id);
            $posts = get_posts($args);
            ?>
            <?php 
            foreach ($posts as $post) {
                ?>
            <?php 
                setup_postdata($post);
                //@TODO
                $rule_discussion_status = 'upcoming';
                if ($currentpost->post_name == $post->post_name) {
                    $rule_discussion_status = 'current';
                }
                ?>
            
            <?php 
                $sidebar_number = null;
                if (isset($digressit_options['show_comment_count_in_sidebar']) && (int) $digressit_options['show_comment_count_in_sidebar'] == 0) {
                    $sidebar_number = $section_number;
                    $commentcountclass = 'section-number';
                    $section_number++;
                } else {
                    $commentcount = null;
                    $commentcount = digressit_get_post_comment_count($post->ID);
                    $commentbubblecolor = $rule_discussion_status == 'current' ? '-dark' : '-grey';
                    if ($commentcount < 10) {
                        $commentcountclass = 'commentcount commentcount1 sidebar-comment-count-single' . $commentbubblecolor;
                    } else {
                        if ($commentcount < 100 && $commentcount > 9) {
                            $commentcountclass = 'commentcount commentcount2 sidebar-comment-count-double' . $commentbubblecolor;
                        } else {
                            $commentcountclass = 'commentcount commentcount3 sidebar-comment-count-triple' . $commentbubblecolor;
                        }
                    }
                    $sidebar_number = $commentcount;
                }
                ?>
            <div id="sidebar-item-<?php 
                echo $post->ID;
                ?>
" class="sidebar-item sidebar-<?php 
                echo $rule_discussion_status;
                ?>
">
                <span class="<?php 
                echo $commentcountclass;
                ?>
"><?php 
                echo $sidebar_number;
                ?>
</span>
                <span class="sidebar-text"><a href="<?php 
                echo get_permalink($post->ID);
                ?>
"><?php 
                echo $post->post_title;
                ?>
</a></span>
            </div>
            <?php 
            }
            ?>
        <?php 
        }
        ?>
            </div>
        <?php 
    }
 function start_el(&$output, $item, $depth, $args)
 {
     global $wp_query, $using_mainpage_nav_walker;
     $using_mainpage_nav_walker = true;
     $indent = $depth ? str_repeat("\t", $depth) : '';
     $class_names = $value = '';
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item));
     $class_names = '';
     $output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '>';
     $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
     $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
     $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
     $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';
     $item_output = $args->before;
     $item_output .= '<a target="_top"' . $attributes . '>';
     $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
     $item_output .= '(' . digressit_get_post_comment_count($item->object_id) . ')</a>';
     $item_output .= $args->after;
     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
 }
/**
 * 
 */
function digressit_list_posts($args = array('number' => -1, 'category_name' => null))
{
    global $wp;
    $myposts = get_posts('order=ASC&orderby=post_date&numberposts=' . $args['number'] . "&category_name=" . $args['category_name']);
    ?>
    
    <ol class="navigation">
    <?php 
    foreach ($myposts as $post) {
        ?>
    <?php 
        $permalink = get_bloginfo('url') . "/" . $wp->query_vars['commentbrowser_function'] . '/' . $post->ID;
        ?>
    <li><a href="<?php 
        echo $permalink;
        ?>
"><?php 
        echo get_the_title($post->ID);
        ?>
 (<?php 
        echo digressit_get_post_comment_count($post->ID, null, null, 1);
        ?>
)</a></li>
    <?php 
    }
    ?>
    </ol>
    <?php 
}