Return to Snippet

Revision: 52520
at October 25, 2011 21:26 by richerimage


Initial Code
function my_archives_template() {
    echo '<ul>';
        $cat_args=array(
            'orderby' => 'name',
            'order' => 'ASC'
        );
        $categories=get_categories($cat_args);
            foreach($categories as $category) {
                $args=array(
                    'showposts' => 50,
                    'category__in' => array($category->term_id),
                    'ignore_sticky_posts'=>1
                );
                $posts=get_posts($args);
                if ($posts) {
                    echo '<li><a href="' . get_category_link($category->term_id) . '" title="' . sprintf( __("View all posts in %s"), $category->name) . '" ' . '>' . $category->name .'</a></li>' . "\n";
                    echo '<ul>';
                    foreach($posts as $post) {
                        setup_postdata($post); 
                        $ptitle = $post->post_title;
                        $plink = get_permalink($post->ID);
                        echo '<li><a href="' . $plink . '">' . $ptitle . '</a></li>'. "\n";
                    } // foreach($posts
                    echo '</ul>' . "\n";
                } // if ($posts
            } // foreach($categories
    echo '</ul>';
}

remove_action('thesis_hook_archives_template', 'thesis_archives_template'); 
add_action('thesis_hook_archives_template', 'my_archives_template');

Initial URL


Initial Description
http://www.briangardner.com/archives/

http://diythemes.com/thesis/rtfm/create-customize-archives-page/

Initial Title
Custom Archive Page

Initial Tags


Initial Language
PHP