Advertisement
kobial8

Archive Page Dynamic

Mar 10th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.71 KB | None | 0 0
  1. Step 01: Copy index.php file and Rename it as archive.php
  2. Step 02: Change the title line with the following codes:
  3.  
  4. <?php if (have_posts()) : ?>
  5.     <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
  6.         <?php /* If this is a category archive */ if (is_category()) { ?>
  7.             <?php _e('Archive for the', 'brightpage'); ?> '<?php echo single_cat_title(); ?>' <?php _e('Category', 'brightpage'); ?>                                   
  8.         <?php /* If this is a tag archive */  } elseif( is_tag() ) { ?>
  9.             <?php _e('Archive for the', 'brightpage'); ?> <?php single_tag_title(); ?> Tag
  10.         <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
  11.             <?php _e('Archive for', 'brightpage'); ?> <?php the_time('F jS, Y'); ?>                                    
  12.         <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
  13.             <?php _e('Archive for', 'brightpage'); ?> <?php the_time('F, Y'); ?>                                   
  14.         <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
  15.             <?php _e('Archive for', 'brightpage'); ?> <?php the_time('Y'); ?>                                      
  16.         <?php /* If this is a search */ } elseif (is_search()) { ?>
  17.             <?php _e('Search Results', 'brightpage'); ?>                           
  18.         <?php /* If this is an author archive */ } elseif (is_author()) { ?>
  19.             <?php _e('Author Archive', 'brightpage'); ?>                                       
  20.         <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
  21.             <?php _e('Blog Archives', 'brightpage'); ?>                                    
  22. <?php } ?> 
  23.  
  24. Step 03: Close the php tag with following codes AFTER the post loop but before the page navigation section:
  25.                  
  26.   <?php else : ?>
  27.          <div class="post">
  28.               <h3><?php _e('404 Error&#58; Not Found', 'Brightpage'); ?></h3>
  29.          </div>
  30.   <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement