Advertisement
Ipstenu

Oxy Front Page

Sep 10th, 2012
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.41 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Template Name: Front Page
  4.  *
  5.  * Magazine layout with several loop areas and a featured content area (slider). This template must be manually set for a page. Then the same page can be set as a Front page from Settings -> Reading -> Front page displays -> A static page.
  6.  *
  7.  * @package Oxygen
  8.  * @subpackage Template
  9.  */
  10.  
  11. /* Set up a default array for posts we're not duplicating. */
  12. $do_not_duplicate = array();
  13.  
  14. get_header(); // Loads the header.php template. ?>
  15.  
  16.     <?php
  17. /**
  18.  * Featured Content (slider)
  19.  *
  20.  */
  21.  
  22. $args = array( 'posts_per_page' => 6 );
  23. $loop = new WP_Query( $args );
  24.        
  25. if ( $loop->have_posts() ) : ?>
  26.        
  27.     <div class="featured-wrapper">
  28.        
  29.         <div id="featured-content">    
  30.  
  31.             <img class="dummy <?php echo ( $loop->post_count == 1 ) ? 'hidden' : ''; ?>" src="<?php echo get_template_directory_uri() . '/images/empty.gif' ?>" alt="" width="750" height="380" />
  32.    
  33.             <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
  34.             <?php $do_not_duplicate[] = get_the_ID(); ?>
  35.  
  36.                     <div class="featured-post">
  37.    
  38.                         <?php if ( current_theme_supports( 'get-the-image' ) ) get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'featured-thumbnail' ) ); ?>
  39.                        
  40.                         <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>
  41.                        
  42.                         <?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( '[entry-published]', 'oxygen' ) . '</div>' ); ?>
  43.                    
  44.                     </div> <!-- .featured-post -->
  45.                    
  46.                 <?php endwhile; ?>
  47.  
  48.             <span id="slider-prev" class="slider-nav">&larr;</span>
  49.             <span id="slider-next" class="slider-nav">&rarr;</span>
  50.            
  51.         </div><!-- #featured-content -->
  52.                
  53.         <div id="slider-nav">
  54.        
  55.             <ul id="slide-thumbs">
  56.                
  57.                 <?php $slidecount = 1;
  58.                 $args = array( 'post__not_in' => get_option( 'sticky_posts' ) );
  59.                
  60.                 while ( $loop->have_posts() ) : $loop->the_post(); ?>
  61.                 <?php $do_not_duplicate[] = get_the_ID(); ?>
  62.                            
  63.                     <li class="<?php echo ( $slidecount == 6 ) ? 'last' : ''; ?>">
  64.                    
  65.                         <?php if ( current_theme_supports( 'get-the-image' ) ) get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'slider-nav-thumbnail' ) ); ?>
  66.                            
  67.                     </li>
  68.                
  69.                     <?php $slidecount++; ?>
  70.                      
  71.                 <?php endwhile; ?>
  72.                    
  73.             </ul>
  74.            
  75.         </div><!-- #slider-nav-->
  76.        
  77.     </div><!-- .featured-wrapper-->
  78.    
  79. <?php endif; ?>
  80.  
  81.     <div class="aside">
  82.    
  83.         <?php get_template_part( 'menu', 'secondary' ); // Loads the menu-secondary.php template.  ?>
  84.        
  85.         <?php get_sidebar( 'primary' ); // Loads the sidebar-primary.php template. ?>
  86.    
  87.     </div>
  88.  
  89.     <?php do_atomic( 'before_content' ); // oxygen_before_content ?>
  90.    
  91.     <div class="content-wrap">
  92.  
  93.         <div id="content">     
  94.    
  95.             <?php do_atomic( 'open_content' ); // oxygen_open_content ?>
  96.    
  97.             <div class="hfeed">
  98.                
  99.                 <h4 class="section-title"><?php _e( 'Recent Articles', 'oxygen' ); ?></h4>
  100.                
  101.                 <?php $args = array( 'post__not_in' => $do_not_duplicate, 'posts_per_page' => 3 ); ?>
  102.                
  103.                 <?php $loop = new WP_Query( $args ); ?>
  104.                
  105.                 <?php if ( $loop->have_posts() ) : ?>
  106.                
  107.                     <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
  108.    
  109.                         <?php do_atomic( 'before_entry' ); // oxygen_before_entry ?>
  110.    
  111.                             <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
  112.    
  113.                                 <?php do_atomic( 'open_entry' ); // oxygen_open_entry ?>
  114.    
  115.                                 <?php if ( current_theme_supports( 'get-the-image' ) ) {
  116.                                            
  117.                                     get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'archive-thumbnail', 'image_class' => 'featured', 'width' => 470, 'height' => 140, 'default_image' => get_template_directory_uri() . '/images/archive-thumbnail-placeholder.gif' ) );                           
  118.                                    
  119.                                 } ?>
  120.                                
  121.                                 <div class="entry-header">
  122.                                        
  123.                                     <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>
  124.                                    
  125.                                     <?php echo apply_atomic_shortcode( 'byline_date', '<div class="byline byline-date">' . __( '[entry-published]', 'oxygen' ) . '</div>' ); ?>
  126.                
  127.                                     <?php echo apply_atomic_shortcode( 'byline_edit', '<div class="byline byline-edit">' . __( '[entry-edit-link]', 'oxygen' ) . '</div>' ); ?>
  128.            
  129.                                 </div>
  130.                                
  131.                                 <?php echo apply_atomic_shortcode( 'byline_category', '<div class="byline byline-cat">' . __( '[entry-terms taxonomy="category" before=""]', 'oxygen' ) . '</div>' ); ?>
  132.                                
  133.                                 <div class="entry-summary">
  134.                                    
  135.                                     <?php the_excerpt(); ?>
  136.                                    
  137.                                     <?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'oxygen' ), 'after' => '</p>' ) ); ?>
  138.                                    
  139.                                 </div>
  140.                                    
  141.                                 <a class="read-more" href="<?php the_permalink(); ?>"><?php _e( 'Read Article', 'oxygen' ); ?> &rarr;</a>
  142.    
  143.                                 <?php do_atomic( 'close_entry' ); // oxygen_close_entry ?>
  144.    
  145.                             </div><!-- .hentry -->
  146.    
  147.                         <?php do_atomic( 'after_entry' ); // oxygen_after_entry ?>
  148.    
  149.                     <?php endwhile; ?>         
  150.    
  151.                 <?php else : ?>
  152.    
  153.                     <?php get_template_part( 'loop-error' ); // Loads the loop-error.php template. ?>
  154.    
  155.                 <?php endif; ?>
  156.                
  157.                 <h4 class="section-title"><?php _e( 'More Articles', 'oxygen' ); ?></h4>
  158.                
  159.                 <div class="hfeed-more">               
  160.                    
  161.                     <?php $args = array( 'post__not_in' => $do_not_duplicate, 'posts_per_page' => 6, 'offset' => 3); ?>
  162.                    
  163.                     <?php $loop = new WP_Query( $args ); ?>
  164.                    
  165.                     <?php if ( $loop->have_posts() ) : ?>
  166.                    
  167.                         <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
  168.                         <?php $do_not_duplicate[] = get_the_ID(); ?>
  169.        
  170.                             <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
  171.                                        
  172.                                 <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>
  173.                                    
  174.                                 <?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( '[entry-published] / in [entry-terms taxonomy="category"] [entry-edit-link before=" / "]', 'oxygen' ) . '</div>' ); ?>
  175.    
  176.                             </div><!-- .hentry -->
  177.        
  178.                         <?php endwhile; ?>         
  179.        
  180.                     <?php else : ?>
  181.        
  182.                         <?php get_template_part( 'loop-error' ); // Loads the loop-error.php template. ?>
  183.        
  184.                     <?php endif; ?>            
  185.        
  186.                 </div><!-- .hfeed-more -->
  187.            
  188.             </div><!-- .hfeed -->
  189.    
  190.             <?php do_atomic( 'close_content' ); // oxygen_close_content ?>
  191.    
  192.         </div><!-- #content -->
  193.    
  194.         <?php do_atomic( 'after_content' ); // oxygen_after_content ?>
  195.  
  196. <?php get_footer(); // Loads the footer.php template. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement