Advertisement
srikat

Untitled

May 18th, 2015
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.07 KB | None | 0 0
  1. <?php
  2.  
  3. // Enqueue Tabslet
  4. wp_enqueue_script( 'tabslet', get_stylesheet_directory_uri() . '/js/jquery.tabslet.min.js', array( 'jquery' ), '1.4.8', true );
  5.  
  6. add_filter( 'genesis_attr_site-inner', 'sk_attributes_site_inner' );
  7. /**
  8. * Add attributes for site-inner element.
  9. *
  10. * @since 2.0.0
  11. *
  12. * @param array $attributes Existing attributes.
  13. *
  14. * @return array Amended attributes.
  15. */
  16. function sk_attributes_site_inner( $attributes ) {
  17.  
  18. $attributes['role'] = 'main';
  19. $attributes['itemprop'] = 'mainContentOfPage';
  20.  
  21. return $attributes;
  22.  
  23. }
  24.  
  25. // Remove div.site-inner's div.wrap
  26. add_filter( 'genesis_structural_wrap-site-inner', '__return_empty_string' );
  27.  
  28. // Display Header
  29. get_header();
  30.  
  31. // Display Page Content
  32. genesis_standard_loop();
  33.  
  34. // Product Tabs
  35.  
  36.  
  37. // echo 'the value of $tab_section_1_icon is: ' . $tab_section_1_icon;
  38.  
  39. $tab_section_1 = get_post_meta( get_the_ID(), 'tab_section_1', true );
  40. $tab_section_2 = get_post_meta( get_the_ID(), 'tab_section_2', true );
  41. $tab_section_3 = get_post_meta( get_the_ID(), 'tab_section_3', true );
  42. $tab_section_4 = get_post_meta( get_the_ID(), 'tab_section_4', true );
  43.  
  44. $tab_section_1_content = get_post_meta( get_the_ID(), 'tab_section_1_content', true );
  45. $tab_section_2_content = get_post_meta( get_the_ID(), 'tab_section_2_content', true );
  46. $tab_section_3_content = get_post_meta( get_the_ID(), 'tab_section_3_content', true );
  47. $tab_section_4_content = get_post_meta( get_the_ID(), 'tab_section_4_content', true );
  48.  
  49. ?>
  50.  
  51. <div class="tabs" data-toggle="tabslet">
  52. <ul>
  53. <li><a href="#tab-1" class="icon-itsupportpanel"><?php echo $tab_section_1; ?></a></li>
  54. <li><a href="#tab-2" class="icon-itnewspanel"><?php echo $tab_section_2; ?></a></li>
  55. <li><a href="#tab-3" class="icon-itappspanel"><?php echo $tab_section_3; ?></a></li>
  56. <li><a href="#tab-4" class="pricing-overview"><?php echo $tab_section_4; ?></a></li>
  57. </ul>
  58. <div id="tab-1"><?php echo $tab_section_1_content; ?></div>
  59. <div id="tab-2"><?php echo $tab_section_2_content; ?></div>
  60. <div id="tab-3"><?php echo $tab_section_3_content; ?></div>
  61. <div id="tab-4"><?php echo $tab_section_4_content; ?></div>
  62. </div>
  63.  
  64. <?php
  65.  
  66. // Displaying icons in tabs
  67.  
  68. add_action( 'wp_head', 'sk_tab_icons' );
  69. function sk_tab_icons() {
  70. $tab_section_1_icon = get_field( 'tab_section_1_icon' ); ?>
  71. <style type="text/css">
  72. .tabs li a.icon-itsupportpanel:before {
  73. background-image: url( <?php echo $tab_section_1_icon; ?> );
  74. }
  75. </style>
  76. <?php }
  77.  
  78. // Product Sections
  79.  
  80. echo '<h2 class="wrap">Why invest in ITSupportPanel?</h2>';
  81.  
  82. if( have_rows( 'section' ) ) {
  83.  
  84. echo '<div class="product-sections clearfix">';
  85. // loop through the rows of data
  86. while ( have_rows( 'section' ) ) : the_row();
  87.  
  88. $section_h2_heading = get_sub_field( 'section_h2_heading' );
  89. $section_content = get_sub_field( 'section_content' );
  90. $section_icon = get_sub_field( 'section_icon' );
  91. $section_featured_image = get_sub_field( 'section_featured_image' ); ?>
  92.  
  93. <div class="product-section"><div class="wrap">
  94. <div class="two-thirds first">
  95.  
  96. <h2 class="section-heading" style="background-image: url(<?php the_sub_field( 'section_icon' ); ?>);"><?php the_sub_field( 'section_h2_heading' ); ?></h2>
  97. <div class="section-content">
  98. <?php the_sub_field( 'section_content' ); ?>
  99. </div>
  100.  
  101. </div>
  102.  
  103. <div class="one-third">
  104.  
  105. <div class="section-featured-image">
  106. <img src="<?php the_sub_field( 'section_featured_image' ); ?>" />
  107. </div>
  108.  
  109. </div>
  110. </div></div>
  111.  
  112. <?php endwhile;
  113. echo '</div>';
  114. }
  115.  
  116. else {
  117. // no product sections found
  118. }
  119.  
  120. genesis_widget_area( 'products-middle', array(
  121. 'before' => '<div class="products-middle widget-area"><div class="wrap">',
  122. 'after' => '</div></div>',
  123. ) );
  124.  
  125. // Customer Testimonials
  126.  
  127. // WP_Query arguments
  128. $args = array (
  129. 'post_type' => 'customers',
  130. 'posts_per_page' => '3',
  131. );
  132.  
  133. // The Query
  134. $query = new WP_Query( $args );
  135.  
  136. // The Loop
  137. if ( $query->have_posts() ) {
  138. echo '<div class="customer-testimonials"><div class="wrap"><h1 class="entry-title" itemprop="headline">Testimonials</h1><div class="clearfix">';
  139. while ( $query->have_posts() ) {
  140. $query->the_post();
  141. // do something
  142. echo '<div class="customer">';
  143. // image
  144. $image = genesis_get_image( 'format=url&size=full' );
  145. printf( '<div class="customer-logo"><a href="%s" rel="bookmark"><img src="%s" alt="%s" /></a></div>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
  146. // excerpt
  147. echo '<div class="customer-content">';
  148. the_excerpt();
  149. echo '</div>';
  150. // title
  151. $title = get_the_title() ? get_the_title() : __( '(no title)', 'genesis' );
  152. printf( '<h2 class="customer-title"><a href="%s">%s</a></h2>', get_permalink(), esc_html( $title ) );
  153. echo '</div>';
  154. }
  155. echo '</div><div class="more-testimonials"><a href="' . trailingslashit( home_url() ) . 'company/customers/
" class="button">View more testimonials</a></div>';
  156. echo '</div></div>';
  157. } else {
  158. // no posts found
  159. }
  160.  
  161. // Restore original Post Data
  162. wp_reset_postdata();
  163.  
  164. // Display Footer
  165. get_footer();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement