Advertisement
Guest User

offerings

a guest
May 29th, 2014
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.45 KB | None | 0 0
  1. //* Offering Subheader -------------------------------------------------------------
  2.  
  3. add_action( 'genesis_entry_header', 'olotus_offerings_subhead' );
  4. function olotus_offerings_subhead() {
  5.    
  6.     // If the post is a single offering and the subheading custom field exists
  7.     if ( is_single() && 'offerings' == get_post_type() && get_field('olotusoff_subheading') )
  8.     // Display the subheading  
  9.     echo
  10.     '<p class="subheading">' . get_field('olotusoff_subheading') . '</p><!-- end subheading -->';
  11.  }
  12.  
  13.  
  14. //* Offering details (yellow box and testimonials) ---------------------------------------------------
  15.  
  16. add_action( 'genesis_entry_content', 'olotus_offerings_details' );
  17. function olotus_offerings_details() {
  18.    
  19.     // If the post is a single offering and the "details" custom fields exist
  20.     if ( is_single() && 'offerings' == get_post_type() && get_field('olotusoff_details') || get_field('olotusoff_cta') || get_field('olotusoff_notice') || get_field('olotusoff_testimonial') ) {
  21.  
  22.     // Open markup for details and testimonials
  23.     echo '<section class="dual-box clearfix">';
  24.        
  25.         // Open markup for details
  26.         echo '<div class="box-first box-small offset-left cta-box">';
  27.        
  28.             // If  details (ACF) are populated
  29.             while( has_sub_field('olotusoff_details') ):
  30.                
  31.                 // Display the details headers and content
  32.                 echo  '<h3>' . get_sub_field('olotusoff_details_heading') . '</h3>
  33.                             <p>' . get_sub_field('olotusoff_details_content') . '</p>';    
  34.             endwhile;
  35.            
  36.             // Display the call to action link and notice
  37.             echo '<a href="' . get_field('olotusoff_ctalink') . '">' . get_field('olotusoff_cta') . '</a>
  38.             <p>' . get_field('olotusoff_notice') . '</p>';
  39.        
  40.         // Close details markup
  41.         echo '</div>';
  42.  
  43.         // Open markup for testimonials
  44.         echo '<div class="box-second box-large">';
  45.  
  46.             // If  testimonials (ACF) are populated
  47.             while( has_sub_field('olotusoff_testimonial') ):
  48.            
  49.                 // Display teh testimonials
  50.                 echo  '<blockquote>
  51.                      <p>' . get_sub_field('olotusoff_testimonial_quote') . '</p>
  52.                       <cite>' . get_sub_field('olotusoff_testimonial_sourcename') . ', <span>' . get_sub_field('olotusoff_testimonial_sourcelocation') . '</span></cite>
  53.                       </blockquote>';
  54.             endwhile;
  55.  
  56.         // Close testimonials markup
  57.         echo '</div>';
  58.  
  59.     // Close markup for details and testimonials
  60.     echo '</section>';
  61.    
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement