Advertisement
grappler

home.php w/ blog

Aug 5th, 2012
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.56 KB | None | 0 0
  1. <?php
  2.  
  3. // Exit if accessed directly
  4. if ( !defined('ABSPATH')) exit;
  5.  
  6. /**
  7.  * Home Page
  8.  *
  9.  * Note: You can overwrite home.php as well as any other Template in Child Theme.
  10.  * Create the same file (name) include in /responsive-child-theme/ and you're all set to go!
  11.  * @see            http://codex.wordpress.org/Child_Themes
  12.  *
  13.  * @file           home.php
  14.  * @package        Responsive
  15.  * @author         Emil Uzelac
  16.  * @copyright      2003 - 2012 ThemeID
  17.  * @license        license.txt
  18.  * @version        Release: 1.0
  19.  * @filesource     wp-content/themes/responsive/home.php
  20.  * @link           http://codex.wordpress.org/Template_Hierarchy
  21.  * @since          available since Release 1.0
  22.  */
  23. ?>
  24. <?php get_header(); ?>
  25.     <?php if ( ! $paged || $paged < 2 ) {?>
  26.         <div id="featured" class="grid col-940">
  27.        
  28.         <div class="grid col-460">
  29.  
  30.             <?php $options = get_option('responsive_theme_options');
  31.             // First let's check if headline was set
  32.                 if ($options['home_headline']) {
  33.                     echo '<h1 class="featured-title">';
  34.                     echo $options['home_headline'];
  35.                     echo '</h1>';
  36.             // If not display dummy headline for preview purposes
  37.                   } else {
  38.                     echo '<h1 class="featured-title">';
  39.                     echo __('Hello, World!','responsive');
  40.                     echo '</h1>';
  41.                   }
  42.             ?>
  43.                    
  44.             <?php $options = get_option('responsive_theme_options');
  45.             // First let's check if headline was set
  46.                 if ($options['home_subheadline']) {
  47.                     echo '<h2 class="featured-subtitle">';
  48.                     echo $options['home_subheadline'];
  49.                     echo '</h2>';
  50.             // If not display dummy headline for preview purposes
  51.                   } else {
  52.                     echo '<h2 class="featured-subtitle">';
  53.                     echo __('Your H2 subheadline here','responsive');
  54.                     echo '</h2>';
  55.                   }
  56.             ?>
  57.            
  58.             <?php $options = get_option('responsive_theme_options');
  59.             // First let's check if content is in place
  60.                 if ($options['home_content_area']) {
  61.                     echo '<p>';
  62.                     echo $options['home_content_area'];
  63.                     echo '</p>';
  64.             // If not let's show dummy content for demo purposes
  65.                   } else {
  66.                     echo '<p>';
  67.                     echo __('Your title, subtitle and this very content is editable from Theme Option.
  68.                           Call to Action button and its destination link as well. Image on your right
  69.                           can be an image or even YouTube video if you like.','responsive');
  70.                     echo '</p>';
  71.                   }
  72.             ?>
  73.            
  74.             <?php $options = get_option('responsive_theme_options'); ?>
  75.             <?php if ($options['cta_button'] == 0): ?>    
  76.             <div class="call-to-action">
  77.  
  78.             <?php $options = get_option('responsive_theme_options');
  79.             // First let's check if headline was set
  80.                 if (!empty($options['cta_url']) && $options['cta_text']) {
  81.                     echo '<a href="'.$options['cta_url'].'" class="blue button">';
  82.                     echo $options['cta_text'];
  83.                     echo '</a>';
  84.             // If not display dummy headline for preview purposes
  85.                   } else {
  86.                     echo '<a href="#nogo" class="blue button">';
  87.                     echo __('Call to Action','responsive');
  88.                     echo '</a>';
  89.                   }
  90.             ?>  
  91.            
  92.             </div><!-- end of .call-to-action -->
  93.             <?php endif; ?>        
  94.            
  95.         </div><!-- end of .col-460 -->
  96.  
  97.         <div id="featured-image" class="grid col-460 fit">
  98.                            
  99.             <?php $options = get_option('responsive_theme_options');
  100.             // First let's check if headline was set
  101.                 if (!empty($options['featured_content'])) {
  102.                     echo $options['featured_content'];
  103.             // If not display dummy headline for preview purposes
  104.                   } else {            
  105.                     echo '<img class="aligncenter" src="'.get_stylesheet_directory_uri().'/images/featured-image.png" width="440" height="300" alt="" />';
  106.                   }
  107.             ?>
  108.                                    
  109.         </div><!-- end of #featured-image -->
  110.        
  111.         </div><!-- end of #featured -->
  112. <?php get_sidebar('home'); ?>
  113.     <?php }?>
  114.         <div id="content-blog" class="grid col-940">
  115. <?php
  116.     if ( get_query_var('paged') )
  117.         $paged = get_query_var('paged');
  118.     elseif ( get_query_var('page') )
  119.         $paged = get_query_var('page');
  120.     else
  121.         $paged = 1;
  122.         query_posts("post_type=post&paged=$paged");
  123.         query_posts( 'posts_per_page=5' );
  124. ?>         
  125. <?php if (have_posts()) : ?>
  126.  
  127.         <?php while (have_posts()) : the_post(); ?>
  128.        
  129.             <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  130.                
  131.                 <h1><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'responsive'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h1>
  132.                
  133.                 <div class="post-meta">
  134.                 <?php
  135.                     printf( __( '<span class="%1$s">Posted on</span> %2$s by %3$s', 'responsive' ),'meta-prep meta-prep-author',
  136.                     sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
  137.                         get_permalink(),
  138.                         esc_attr( get_the_time() ),
  139.                         get_the_date()
  140.                     ),
  141.                     sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
  142.                         get_author_posts_url( get_the_author_meta( 'ID' ) ),
  143.                     sprintf( esc_attr__( 'View all posts by %s', 'responsive' ), get_the_author() ),
  144.                         get_the_author()
  145.                         )
  146.                     );
  147.                 ?>
  148.                     <?php if ( comments_open() ) : ?>
  149.                         <span class="comments-link">
  150.                         <span class="mdash">&mdash;</span>
  151.                     <?php comments_popup_link(__('No Comments &darr;', 'responsive'), __('1 Comment &darr;', 'responsive'), __('% Comments &darr;', 'responsive')); ?>
  152.                         </span>
  153.                     <?php endif; ?>
  154.                 </div><!-- end of .post-meta -->
  155.                
  156.                 <div class="post-entry">
  157.                     <?php if ( has_post_thumbnail()) : ?>
  158.                         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
  159.                     <?php the_post_thumbnail(); ?>
  160.                         </a>
  161.                     <?php endif; ?>
  162.                     <?php the_content(__('Read more &#8250;', 'responsive')); ?>
  163.                     <?php wp_link_pages(array('before' => '<div class="pagination">' . __('Pages:', 'responsive'), 'after' => '</div>')); ?>
  164.                 </div><!-- end of .post-entry -->
  165.                
  166.                 <div class="post-data">
  167.                     <?php the_tags(__('Tagged with:', 'responsive') . ' ', ', ', '<br />'); ?>
  168.                     <?php printf(__('Posted in %s', 'responsive'), get_the_category_list(', ')); ?>
  169.                 </div><!-- end of .post-data -->            
  170.  
  171.             <div class="post-edit"><?php edit_post_link(__('Edit', 'responsive')); ?></div>              
  172.             </div><!-- end of #post-<?php the_ID(); ?> -->
  173.            
  174.         <?php endwhile; ?>
  175.        
  176.         <?php if (  $wp_query->max_num_pages > 1 ) : ?>
  177.         <div class="navigation">
  178.             <div class="previous"><?php next_posts_link( __( '&#8249; Older posts', 'responsive' ) ); ?></div>
  179.             <div class="next"><?php previous_posts_link( __( 'Newer posts &#8250;', 'responsive' ) ); ?></div>
  180.         </div><!-- end of .navigation -->
  181.         <?php endif; ?>
  182.  
  183. <?php endif; ?>  
  184.      
  185.         </div><!-- end of #content-blog -->              
  186. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement