Advertisement
srikat

front-page.php

Apr 23rd, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.47 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Front Page with full width sections.
  4.  *
  5.  * @author      Sridhar Katakam
  6.  * @license      GPL-2.0+
  7.  */
  8.  
  9. // Display header
  10. get_header();
  11.  
  12. // Display Homepage Flexible Content
  13. // check if the flexible content field has rows of data
  14. if( have_rows('hero_section') ) {
  15.  
  16.     // loop through the rows of data
  17.     while ( have_rows('hero_section') ) : the_row();
  18.         if( get_row_layout() == 'hero_section' ) {
  19.  
  20.             $image = get_sub_field( 'hero_image' );
  21.             echo '<section class="row hero"><img src="' . $image['url'] . '" alt="' . $image['alt'] . '" /><div class="hero-content wrap">'. get_sub_field( 'hero_overlay_content' ) .'</div></section>';
  22.  
  23.         }
  24.  
  25.     endwhile;
  26. }
  27.  
  28. else {
  29.     // no layouts found
  30. }
  31.  
  32. genesis_widget_area( 'below-hero', array(
  33.     'before'    => '<div class="below-hero widget-area"><div class="wrap">',
  34.     'after'     => '</div></div>',
  35. ) );
  36.  
  37. // Testimonials Slider Begin
  38.  
  39. // WP_Query arguments
  40. $args = array (
  41.     'post_type'              => 'testimonial',
  42.     'posts_per_page'         => '4',
  43. );
  44.  
  45. // The Query
  46. $query = new WP_Query( $args );
  47.  
  48. // The Loop
  49. if ( $query->have_posts() ) {
  50.     echo '<div class="testimonials-slider"><div class="wrap"><h3 class="testimonials-title">What People are Saying</h3><div class="testimonial-items">';
  51.     while ( $query->have_posts() ) {
  52.         $query->the_post();
  53.         // each loop item
  54.         $byline = esc_attr( get_post_meta( get_the_ID(), '_byline', true ) );
  55.         ?>
  56.         <div class="testimonial-item">
  57.             <div class="left"><?php genesis_image( array( 'size' => 'testimonial-thumb' ) ); ?></div>
  58.             <div class="right">
  59.                 <div class="testimonial-content"><?php the_content(); ?></div>
  60.                 <div class="testifier"><?php the_title(); ?></div>
  61.                 <?php echo $byline; ?>
  62.             </div>
  63.  
  64.         </div>
  65.     <?php }
  66.     echo '</div></div></div>';
  67. } else {
  68.     // no posts found
  69. }
  70.  
  71. // Restore original Post Data
  72. wp_reset_postdata();
  73.  
  74. // Testimonials Slider End
  75.  
  76. // Blog Posts
  77.  
  78. // accepts any wp_query args
  79. $args = (array(
  80.     'posts_per_page' => 3
  81. ));
  82.  
  83. echo '<div class="blog-posts"><div class="wrap"><h2 class="recent-posts-title">Recent Posts</h2>';
  84.     genesis_custom_loop( $args );
  85. echo '<div class="browse-archive"><a href="/blog/" class="button">Read the Blog</a></div></div></div>';
  86.  
  87. // Products Slider Begin
  88.  
  89. // WP_Query arguments
  90. $args = array (
  91.     'post_type'              => 'download',
  92.     'posts_per_page'         => '4',
  93.     'tax_query' => array(
  94.         array(
  95.             'taxonomy' => 'download_category',
  96.             'field'    => 'slug',
  97.             'terms'    => 'featured',
  98.         ),
  99.     ),
  100. );
  101.  
  102. // The Query
  103. $query = new WP_Query( $args );
  104.  
  105. // The Loop
  106. if ( $query->have_posts() ) {
  107.     echo '<div class="products-slider"><div class="wrap"><h3 class="products-title">Featured Product</h3><div class="products">';
  108.     while ( $query->have_posts() ) {
  109.         $query->the_post();
  110.         // each loop item
  111.         ?>
  112.         <div class="product">
  113.             <div class="left"><a href="<?php the_permalink(); ?>"><?php genesis_image( array( 'size' => 'product-thumb' ) ); ?></a></div>
  114.             <div class="right">
  115.                 <div class="product-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
  116.                 <div class="product-content"><?php the_content(); ?></div>
  117.             </div>
  118.  
  119.         </div>
  120.     <?php }
  121.     echo '</div></div></div>';
  122. } else {
  123.     // no posts found
  124. }
  125.  
  126. // Restore original Post Data
  127. wp_reset_postdata();
  128.  
  129. // Products Slider End
  130.  
  131. genesis_widget_area( 'home-above-footer', array(
  132.     'before'    => '<div class="home-above-footer widget-area">',
  133.     'after'     => '</div>',
  134. ) );
  135.  
  136. // Display Footer
  137. get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement