Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

archive page template

By: a guest on Apr 28th, 2012  |  syntax: PHP  |  size: 2.43 KB  |  views: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php get_header(); ?>
  2.   <?php roots_content_before(); ?>
  3.     <div id="content" class="<?php echo CONTAINER_CLASSES; ?>">
  4.     <?php roots_main_before(); ?>
  5.       <div id="main" class="<?php echo MAIN_CLASSES; ?>" role="main">
  6.  
  7. <div class="my-main">
  8.  
  9.         <div class="page-header">
  10.  
  11.           <h1>
  12.             <?php
  13.               $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
  14.               if ($term) {
  15.                 echo $term->name;
  16.               } elseif (is_day()) {
  17.                 printf(__('Daily Archives: %s', 'roots'), get_the_date());
  18.               } elseif (is_month()) {
  19.                 printf(__('Monthly Archives: %s', 'roots'), get_the_date('F Y'));
  20.               } elseif (is_year()) {
  21.                 printf(__('Yearly Archives: %s', 'roots'), get_the_date('Y'));
  22.               } elseif (is_author()) {
  23.                 global $post;
  24.                 $author_id = $post->post_author;
  25.                 printf(__('Author Archives: %s', 'roots'), get_the_author_meta('user_nicename', $author_id));
  26.               } else {
  27.                 single_cat_title();
  28.               }
  29.             ?>
  30.           </h1>
  31.  
  32.  
  33.  
  34. </div><!-- header -->
  35.  
  36. <?php echo category_description(); ?>
  37.  
  38. <div class="bar"><span class="heading">Related Articles</span></div>
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. <?php
  47.     //The third parameter corresponds to action priority,
  48.     //set it to change the order of execution in case of a conflict
  49.     add_action('pre_get_posts', 'the_modified_loop', 10);
  50.  
  51.     function the_modified_loop($query){
  52.         //Remove 'is_admin' if you want the code to run for the backend category archive page
  53.         if(!is_admin() && $query->is_category()){
  54.             $query->set('offset', 3);
  55.         }
  56.     }
  57. ?>
  58.         <?php roots_loop_before(); ?>
  59.         <?php get_template_part('loop', 'category'); ?>
  60.         <?php roots_loop_after(); ?>
  61.  
  62. <?php
  63. remove_action('pre_get_posts', 'the_modified_loop');
  64. ?>
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. </div>
  75.  
  76.       </div><!-- /#main -->
  77.     <?php roots_main_after(); ?>
  78.     <?php roots_sidebar_before(); ?>
  79.       <aside id="sidebar" class="<?php echo SIDEBAR_CLASSES; ?>" role="complementary">
  80.       <?php roots_sidebar_inside_before(); ?>
  81.         <?php get_sidebar(); ?>
  82.       <?php roots_sidebar_inside_after(); ?>
  83.       </aside><!-- /#sidebar -->
  84.     <?php roots_sidebar_after(); ?>
  85.     </div><!-- /#content -->
  86.   <?php roots_content_after(); ?>
  87. <?php get_footer(); ?>