INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Wordpress - Archive Page

Wordpress - Archive Page

(OP)
Hey Guys,

Problem:
Getting the Archives page to show a list of every single post if nothing specific has been selected (category, date). Currently, when landing on the archives page, there is not actually any information - please see link.

Site:
http://collossalpixel.com/archives/

Info:
When selecting a category or date from the archive section on the right sidebar (Filter Category / Filter Date) the archive.php file works perfectly and exactly as instructed to. But, when no specific archive section has been called upon, the archive page simply sits there in an extremely unuseful state - please see link.

What I want to be able to do, is to have a list of every single archive post (formatting can come later) on this page. This will involve a load of PHP, which I am not that 'fluent' in. This will be the landing archive page, where anybody can see every post made, regardless of categories, tags or dates etc.

The current PHP is as follows:

CODE

<?php /*Template Name: Archives*/
?>

<?php get_header(); ?>

<div class="b-wrap">

    <section class="a-wrap">
    
    <?php the_post(); ?>  
   
    <?php if ( is_day() ) : ?>
                
        <div class="a-year">
    
        <h2 class="page-title"><?php printf(get_the_time(get_option('date_format')) ) ?></h2>
        
        </div><!-- .a-year -->
        
        <div class="line single-line"></div>
        
        <?php elseif ( is_month() ) : ?>
                    
            <div class="a-year">
        
            <h2 class="page-title"><?php printf(get_the_time('F Y') ) ?></h2>
            
            </div><!-- .a-year -->
            
            <div class="line single-line"></div>
            
        <?php elseif ( is_year() ) : ?>
        
            <div class="a-year">
        
            <h2><?php printf(get_the_time('Y')) ?></h2>
            
            </div><!-- a-year -->
            
            <div class="clear"></div>
            
            <div class="line single-line"></div>
            
        <?php elseif ( is_category() ) : ?>
        
            <div class="a-year">
        
            <h2><?php printf(the_category()) ?></h2>
            
            </div><!-- a-year -->
                        
            <div class="line single-line"></div>
            
        <?php elseif ( isset($_GET['paged']) && !empty($_GET['paged']) ) : ?>
        
            <h1 class="page-title"><?php _e( 'Blog Archives', 'your-theme' ) ?></h1>
        
    <?php endif; ?>
    
    <?php rewind_posts(); ?>
       
    <?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?>
    
        <div id="nav-above" class="navigation">
        
        <div class="nav-previous">
             <?php next_posts_link(__( '<span class="meta-nav">&laquo;</span> Older posts', 'your-theme' )) ?>
        </div><!-- .nav-previous -->
        
        <div class="nav-next">
             <?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&raquo;</span>', 'your-theme' )) ?>
        </div><!-- .nav-next -->
        
        </div><!-- #nav-above .navigation -->
        
    <?php } ?>  
    
    <?php while ( have_posts() ) : the_post(); ?>

        <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        
            <div class="top-title">
        
            <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( __('Permalink to %s', 'your-theme'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    
            <div class="entry-meta">
                <span class="meta-prep meta-prep-entry-date"><?php _e('Published ', 'your-theme'); ?></span>
                <span class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO') ?>"><?php the_time( get_option( 'date_format' ) ); ?></abbr></span>
                <?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t" ) ?>
            </div><!-- .entry-meta -->
            
            <div class="clear"></div>
            
            </div><!-- .top-title -->
        
            <div class="entry-summary">
                <?php the_excerpt( __( 'Continue reading <span class="meta-nav">&raquo;</span>', 'your-theme' )  ); ?>
            </div><!-- .entry-summary -->
    
            <div class="entry-utility">
                <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'your-theme' ); ?></span><?php echo get_the_category_list(', '); ?></span>
                <span class="meta-sep"> | </span>
                <?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __('Tagged ', 'your-theme' ) . '</span>', ", ", "</span>\n\t\t\t\t\t\t<span class=\"meta-sep\">|</span>\n" ) ?>
                <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'your-theme' ), __( '1 Comment', 'your-theme' ), __( '% Comments', 'your-theme' ) ) ?></span>
                <?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t\n" ) ?>
            </div><!-- #entry-utility -->
            
        </div><!-- #post-<?php the_ID(); ?> -->

    <?php endwhile; ?>  

    <?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?>
    
        <div id="nav-below" class="navigation">
        
            <div class="nav-previous">
            <?php next_posts_link(__( '<span class="meta-nav">&laquo;</span> Older posts', 'your-theme' )) ?>
            </div>
            
            <div class="nav-next">
            <?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&raquo;</span>', 'your-theme' )) ?>
            </div>
        
        </div><!-- #nav-below -->
        
    <?php } ?>
    
    </section><!-- .a-wrap -->
    
    <?php include ('asider-r.php'); ?>
    
    <div class="clear"></div>

</div><!-- .b-wrap -->    

<?php get_footer(); ?>

Hopefully I have explained this well enough for you to understand, but it's late and I'm tired so apologies if not!

Many Thanks,
Ali

RE: Wordpress - Archive Page

that's not really how archives are supposed to work.  it is normal to get a 404 or nothing found message if you land directly on the archive page.

i haven't given this much though but perhaps this will fix it

CODE

<?php /*Template Name: Archives*/
?>

<?php get_header(); ?>

<div class="b-wrap">

    <section class="a-wrap">
    
    <?php if (have_posts()) : the_post(); ?>  
   
    <?php if ( is_day() ) : ?>
                
        <div class="a-year">
    
        <h2 class="page-title"><?php printf(get_the_time(get_option('date_format')) ) ?></h2>
        
        </div><!-- .a-year -->
        
        <div class="line single-line"></div>
        
        <?php elseif ( is_month() ) : ?>
                    
            <div class="a-year">
        
            <h2 class="page-title"><?php printf(get_the_time('F Y') ) ?></h2>
            
            </div><!-- .a-year -->
            
            <div class="line single-line"></div>
            
        <?php elseif ( is_year() ) : ?>
        
            <div class="a-year">
        
            <h2><?php printf(get_the_time('Y')) ?></h2>
            
            </div><!-- a-year -->
            
            <div class="clear"></div>
            
            <div class="line single-line"></div>
            
        <?php elseif ( is_category() ) : ?>
        
            <div class="a-year">
        
            <h2><?php printf(the_category()) ?></h2>
            
            </div><!-- a-year -->
                        
            <div class="line single-line"></div>
            
        <?php elseif ( isset($_GET['paged']) && !empty($_GET['paged']) ) : ?>
        
            <h1 class="page-title"><?php _e( 'Blog Archives', 'your-theme' ) ?></h1>
    
        
    <?php endif; ?>
    <?php
    else:
        query_posts('posts_per_page=5');
    endif;?>
    
    <?php rewind_posts(); ?>
       
    <?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?>
    
        <div id="nav-above" class="navigation">
        
        <div class="nav-previous">
             <?php next_posts_link(__( '<span class="meta-nav">&laquo;</span> Older posts', 'your-theme' )) ?>
        </div><!-- .nav-previous -->
        
        <div class="nav-next">
             <?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&raquo;</span>', 'your-theme' )) ?>
        </div><!-- .nav-next -->
        
        </div><!-- #nav-above .navigation -->
        
    <?php } ?>  
    
    <?php while ( have_posts() ) : the_post(); ?>

        <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        
            <div class="top-title">
        
            <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( __('Permalink to %s', 'your-theme'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    
            <div class="entry-meta">
                <span class="meta-prep meta-prep-entry-date"><?php _e('Published ', 'your-theme'); ?></span>
                <span class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO') ?>"><?php the_time( get_option( 'date_format' ) ); ?></abbr></span>
                <?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t" ) ?>
            </div><!-- .entry-meta -->
            
            <div class="clear"></div>
            
            </div><!-- .top-title -->
        
            <div class="entry-summary">
                <?php the_excerpt( __( 'Continue reading <span class="meta-nav">&raquo;</span>', 'your-theme' )  ); ?>
            </div><!-- .entry-summary -->
    
            <div class="entry-utility">
                <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'your-theme' ); ?></span><?php echo get_the_category_list(', '); ?></span>
                <span class="meta-sep"> | </span>
                <?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __('Tagged ', 'your-theme' ) . '</span>', ", ", "</span>\n\t\t\t\t\t\t<span class=\"meta-sep\">|</span>\n" ) ?>
                <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'your-theme' ), __( '1 Comment', 'your-theme' ), __( '% Comments', 'your-theme' ) ) ?></span>
                <?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t\n" ) ?>
            </div><!-- #entry-utility -->
            
        </div><!-- #post-<?php the_ID(); ?> -->

    <?php endwhile; ?>  

    <?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?>
    
        <div id="nav-below" class="navigation">
        
            <div class="nav-previous">
            <?php next_posts_link(__( '<span class="meta-nav">&laquo;</span> Older posts', 'your-theme' )) ?>
            </div>
            
            <div class="nav-next">
            <?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&raquo;</span>', 'your-theme' )) ?>
            </div>
        
        </div><!-- #nav-below -->
        
    <?php } ?>
    
    </section><!-- .a-wrap -->
    
    <?php include ('asider-r.php'); ?>
    
    <div class="clear"></div>

</div><!-- .b-wrap -->    

<?php get_footer();
?>

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close