Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.29 KB | None | 0 0
  1. if( have_rows('banner_layout') ):
  2.             echo "Banner<br>";
  3.                 while( have_rows('banner_layout') ) : the_row();
  4.                     // Get values from ACF
  5.                     if( get_row_layout() == 'heading_+_form'):
  6.                         $heading_text = get_sub_field('heading_text');
  7.                         $form_id = get_sub_field('form_id');
  8.                         $background_image = get_sub_field('background_image'); 
  9.                     elseif ( get_row_layout() == 'heading_(background)_+_form'):
  10.                         $heading_text = get_sub_field('heading_text');
  11.                         $form_id = get_sub_field('form_id');
  12.                         $background_image = get_sub_field('background_image');
  13.                         $background_text_color = get_sub_field('text_background_color');
  14.                     elseif ( get_row_layout() == 'heading_only'):
  15.                         $heading_text = get_sub_field('heading_text');
  16.                         $background_image = get_sub_field('background_image');
  17.                     endif;
  18.                 endwhile;
  19.    
  20.                 // Output the HTML
  21.                 if($heading_text){
  22.                     echo "Value for heading text is ".$heading_text."<br>";
  23.                 };
  24.                 if($form_id) {
  25.                     echo "Value for form id is ".$form_id."<br>";
  26.                 };
  27.                 if($background_image) {
  28.                     echo "Value for background image is ".$background_image."<br>";
  29.                 };
  30.                 if($background_text_color) {
  31.                     echo "Value for background text color field is ".$background_text_color."<br>";
  32.                 }; 
  33.            
  34.             else :
  35.             // no content
  36.         endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement