Skip to content

Instantly share code, notes, and snippets.

@atwellpub
Created June 24, 2016 20:45
Show Gist options
  • Save atwellpub/da0ee0373080fc5ef508558a0e012909 to your computer and use it in GitHub Desktop.
Save atwellpub/da0ee0373080fc5ef508558a0e012909 to your computer and use it in GitHub Desktop.
Acacia Index.php
<?php
/**
* Template Name: Acacia
* @package WordPress Landing Pages
* @author Inbound Template Generator
*/
/* Declare Template Key */
$key = basename(dirname(__FILE__));
/* discover the absolute path of where this template is located. Core templates are loacted in /wp-content/plugins/landing-pages/templates/ while custom templates belong in /wp-content/uploads/landing-pages/tempaltes/ */
$path = LANDINGPAGES_UPLOADS_URLPATH . "$key/";
$urlpath = LANDINGPAGES_UPLOADS_URLPATH . "$key/";
/* Include ACF Field Definitions */
include_once(LANDINGPAGES_UPLOADS_PATH.$key.'/config.php');
/* Enqueue Styles and Scripts */
function acacia_enqueue_scripts() {
$key = basename(dirname(__FILE__));
$path = LANDINGPAGES_UPLOADS_URLPATH ."$key/";
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'acacia-bootstrap-js', $path . 'assets/js/bootstrap.min.js', '','', true );
wp_enqueue_script( 'acacia-retina-js', $path . 'assets/js/retina-1.1.0.js', '','', true );
wp_enqueue_script( 'acacia-ie-bug-js', $path . 'assets/js/ie10-viewport-bug-workaround.js', '','', true );
wp_enqueue_style( 'acacia-bootstrap-css', $path . 'assets/css/bootstrap.css' );
wp_enqueue_style( 'acacia-css', $path . 'assets/css/style.css' );
}
/* for some unknown reason the wp_enqueue_scripts hook doesn't work here for css (but it works for js). */
add_action('wp_head', 'acacia_enqueue_scripts');
/* Define Landing Pages's custom pre-load hook for 3rd party plugin integration */
do_action('wp_head');
if (have_posts()) : while (have_posts()) : the_post();
$post_id = get_the_ID();
$footer_text_color = get_field("footer_text_color", $post_id);
$form_fields_bg_color = get_field("form_fields_bg_color", $post_id);
$form_button_color = get_field("form_button_color", $post_id);
$form_button_text_color = get_field("form_button_text_color", $post_id);
?>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]> <html class="no-js" lang="en"> <!<![endif]-->
<head>
<!-- Define page title -->
<title><?php wp_title(); ?></title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="LandingSumo.com">
<style>
#inbound-form-wrapper button {
min-height: 60px;
border-radius: 40px !important;
line-height: 24px;
padding: 16px 30px 20px;
border: none !important;
color: <?php echo $form_button_text_color; ?> !important;
background-color: <?php echo $form_button_color; ?> !important;
}
#inbound-form-wrapper label,
#inbound-form-wrapper .radio-inbound-label-top,
#inbound-form-wrapper .label-inbound-label-top {
color: <?php echo $footer_text_color; ?> !important;
}
#inbound-form-wrapper input, #inbound-form-wrapper textarea, #inbound-form-wrapper select {
background-color: <?php echo $form_fields_bg_color; ?> !important;
}
#inbound-form-wrapper textarea:placeholder {
color: #a9a9a9 !important;
}
</style>
<!-- Load Normal WordPress wp_head() function -->
<?php wp_head(); ?>
<!-- Load Landing Pages's custom pre-load hook for 3rd party plugin integration -->
<?php do_action("lp_head"); ?>
</head>
<body>
<?php
/* Start acacia_template_body Flexible Content Area Output */
if(function_exists('have_rows')) :
if(have_rows('acacia_template_body')) :
while(have_rows('acacia_template_body')) : the_row();
switch( get_sub_field('acf_fc_layout')) :
// start layout hero_box
case 'hero_box' :
$hero_bg_color = get_sub_field("hero_bg_color");
$add_media = get_sub_field("add_media");
$hero_image = get_sub_field("hero_image");
$hero_video = get_sub_field("hero_video");
$hero_video_width = get_sub_field("hero_video_width");
$hero_video_height = get_sub_field("hero_video_height");
$hero_headline = get_sub_field("hero_headline");
$hero_headline_color = get_sub_field("hero_headline_color");
$hero_sub_headline = get_sub_field("hero_sub_headline");
$hero_sub_headline_color = get_sub_field("hero_sub_headline_color");
$hero_button_text = get_sub_field("hero_button_text");
$hero_button_text_color = get_sub_field("hero_button_text_color");
$hero_button_link = get_sub_field("hero_button_link");
$hero_button_bg_color = get_sub_field("hero_button_bg_color");
?>
<div class="is" style="background-color:<?php echo $hero_bg_color; ?>;">
<div class="container" style="">
<div class="row" style="">
<div class="col-lg-6 col-md-6 centered" style="-webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; transform-style: preserve-3d;">
<?php if ( 'image' == $add_media) {
if ( ! $hero_image ) {
echo '<img height="600px" alt="" src="' . $urlpath . 'assets/img/phone.png">';
} else {
echo '<img style="max-width: 100%;" alt="" src="'. $hero_image .'">';
}
} else {
echo $hero_video;
} ?>
</div>
<div class="col-lg-6 col-md-6 centered" style="-webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; transform-style: preserve-3d;">
<div class="vertical-center" style="max-width: 100%;">
<h1 style="color:<?php echo $hero_headline_color; ?>"><?php echo $hero_headline; ?></h1>
<div style="color:<?php echo $hero_sub_headline_color; ?>"><?php echo $hero_sub_headline; ?></div>
<a href="<?php echo $hero_button_link; ?>" class="btn btn-lg btn-standard mtb" style="border: 4px solid <?php echo $hero_button_bg_color; ?>; background-color:<?php echo $hero_button_bg_color; ?>; color:<?php echo $hero_button_text_color; ?>"
onmouseover = "this.style.color = '<?php echo $hero_button_bg_color; ?>';
this.style.background = 'transparent'"
onmouseout = "this.style.color = '<?php echo $hero_button_text_color ?>';
this.style.background = '<?php echo $hero_button_bg_color; ?>';">
<?php echo $hero_button_text; ?>
</a>
</div>
</div>
</div><!--/row -->
<script type="text/javascript">
jQuery(document).ready(function($) {
$('.is').find('iframe').attr('height', '<?php echo $hero_video_height; ?>px');
$('.is').find('iframe').attr('width', '<?php echo $hero_video_width; ?>px');
//$('.is').find('iframe').addClass('vertical-center');
//$('.is').find('img').addClass('vertical-center');
});
</script>
</div><!--/container -->
</div><!-- /.IS Wrap -->
<?php
break;
/* start layout three_columns_text */
case 'three_columns_text' :
$three_col_bg_color = get_sub_field("three_col_bg_color");
$three_col_text_color = get_sub_field("three_col_text_color");
$three_col_headline = get_sub_field("three_col_headline");
$three_col_column_1_text = get_sub_field("three_col_column_1_text");
$three_col_column_1_icon = get_sub_field("three_col_column_1_icon");
$three_col_column_2_text = get_sub_field("three_col_column_2_text");
$three_col_column_2_icon = get_sub_field("three_col_column_2_icon");
$three_col_column_3_text = get_sub_field("three_col_column_3_text");
$three_col_column_3_icon = get_sub_field("three_col_column_3_icon");
?>
<div class="three-col" style="background-color:<?php echo $three_col_bg_color; ?>">
<div class="container">
<div class="row mtb centered">
<h2 style="color:<?php echo $three_col_text_color; ?>"><?php echo $three_col_headline; ?></h2>
<div class="icons-white-bg mt">
<div class="col-md-4">
<i class="fa <?php echo $three_col_column_1_icon; ?>" style="color:<?php echo $three_col_text_color; ?>"></i>
<p style="color:<?php echo $three_col_text_color; ?>"><?php echo $three_col_column_1_text; ?></p>
</div><!--/col-md-4 -->
<div class="col-md-4">
<i class="fa <?php echo $three_col_column_2_icon; ?>" style="color:<?php echo $three_col_text_color; ?>"></i>
<p style="color:<?php echo $three_col_text_color; ?>"><?php echo $three_col_column_2_text; ?></p>
</div><!--/col-md-4 -->
<div class="col-md-4">
<i class="fa <?php echo $three_col_column_3_icon; ?>" style="color:<?php echo $three_col_text_color; ?>"></i>
<p style="color:<?php echo $three_col_text_color; ?>"><?php echo $three_col_column_3_text; ?></p>
</div><!--/col-md-4 -->
</div><!--/icons-white-bg -->
</div><!--/row -->
</div><!--/container -->
</div>
<?php break;
/* start layout testimonials */
case 'testimonials' :
$testimonials_bg_color = get_sub_field("testimonials_bg_color");
$testimonials_optional_header = get_sub_field("testimonials_optional_header");
$testimonials_header = get_sub_field("testimonials_header");
$testimonials_header_color = get_sub_field("testimonials_header_color");
?>
<div class="mint carousel slide" data-ride="carousel" style="background-color:<?php echo $testimonials_bg_color ?>">
<?php
if ( isset( $testimonials_optional_header[0]) && "Add Header" == $testimonials_optional_header[0] ) {
?>
<div class="col-md-12 centered">
<h2 style="color:<?php echo $testimonials_header_color; ?>"><?php echo $testimonials_header; ?></h2>
</div>
<?php } ?>
<div class="col-md-6 col-md-offset-3">
<!-- Carousel
================================================== -->
<!-- Indicators -->
<ol class="carousel-indicators">
<?php
/* Start testimonial Repeater Output Carousel */
if ( have_rows( "testimonial" ) ) { ?>
<?php $slide = 0;
$class = 'active'; ?>
<?php while ( have_rows( "testimonial" ) ) : the_row();
?>
<li style="border:1px solid #000;" data-target=".mint" data-slide-to="<?php echo $slide; ?>" class="<?php echo $class; ?>"></li>
<?php
$slide += 1;
$class = ''; //only the first item has class 'active'
endwhile;
}
?>
</ol>
<div class="carousel-inner">
<?php
$class = 'active';
/* Start testimonial Repeater Output */
if ( have_rows( "testimonial" ) ) { ?>
<?php while ( have_rows( "testimonial" ) ) : the_row();
$testimonial_image = get_sub_field("testimonial_image");
$testimonial_text = get_sub_field("testimonial_text");
$testimonial_text_color = get_sub_field("testimonial_text_color");
$testimonial_name = get_sub_field("testimonial_name");
$testimonial_name_color = get_sub_field("testimonial_name_color");
$testimonial_name_link = get_sub_field("testimonial_name_link");
?>
<div class="item <?php echo $class; ?>">
<div class="centered mtb">
<?php
if ( ! $testimonial_image ) {
echo '<img src="' . $urlpath . 'assets/img/pic02.jpg" class="img-circle" height="100" width="100" alt="slide">';
} else {
echo '<img src="' . $testimonial_image . '" class="img-circle" height="100" width="100" alt="slide">';
}
?>
<h4 style="color:<?php echo $testimonial_text_color; ?>"><?php echo $testimonial_text; ?></h4>
<p style="color:<?php echo $testimonial_name_color; ?>"><?php echo strtoupper($testimonial_name); ?></p>
</div>
</div><!-- /item -->
<?php
$class = '';
endwhile; ?>
<?php } /* end if have_rows(testimonial) */
/* End testimonial Repeater Output */
?>
</div><!--/carousel-inner -->
</div><!--/col-md-6 -->
</div><!--/mint -->
<?php break;
/* start layout faq_section */
case 'faq_section' :
$faq_bg_color = get_sub_field("faq_bg_color");
$faq_text_color = get_sub_field("faq_text_color");
$faq_headline = get_sub_field("faq_headline");
/* Start faqs Repeater Output */
if ( have_rows( "faqs" ) ) { ?>
<div class="faq" style="background-color: <?php echo $faq_bg_color; ?>;">
<div class="container">
<div class="row mtb">
<h2 class="centered" style="color:<?php echo $faq_text_color; ?>"><?php echo $faq_headline; ?></h2>
<?php while ( have_rows( "faqs" ) ) : the_row();
$faq_title = get_sub_field("faq_title");
$faq_content = get_sub_field("faq_content");
?>
<div class="col-md-6 mt">
<h4 style="color:<?php echo $faq_text_color; ?>"><?php echo $faq_title; ?></h4>
<p style="color:<?php echo $faq_text_color; ?>"><?php echo $faq_content; ?></p>
</div><!--/col-md-6 -->
<?php endwhile;?>
<?php } /* end if have_rows(faqs) */
/* End faqs Repeater Output */
$more_questions_button_text = get_sub_field("more_questions_button_text");
$more_questions_button_link = get_sub_field("more_questions_button_link");
$more_questions_button_color = get_sub_field("more_questions_button_color");
$more_questions_button_text_color = get_sub_field("more_questions_button_text_color");
?>
<div class="col-md-12 centered mtb" style="margin-top: 0;">
<a href="<?php echo $more_questions_button_link; ?>" class="btn btn-lg btn-standard mt" style="color:<?php echo $more_questions_button_text_color; ?>; background-color:<?php echo $more_questions_button_color; ?>; border: 4px solid <?php echo $more_questions_button_color; ?>;"
onmouseover = "this.style.color = '<?php echo $more_questions_button_color; ?>';
this.style.background = 'transparent'"
onmouseout = "this.style.color = '<?php echo $more_questions_button_text_color; ?>';
this.style.background = '<?php echo $more_questions_button_color; ?>';">
<?php echo $more_questions_button_text; ?>
</a>
</div><!--/centered -->
</div><!--/row -->
</div><!-- /container -->
</div><!-- /faq -->
<?php break;
endswitch; /* end switch statement */
endwhile; /* end while statement */
endif; /* end have_rows */
endif; /* end function_exists */
/* End acacia_template_body Flexible Content Area Output */
$choose_the_footer_background = get_field("choose_the_footer_background", $post_id);
$footer_background_color = get_field("footer_background_color", $post_id);
$footer_background_image = get_field("footer_background_image", $post_id);
$footer_form_shortcode = get_field("footer_form_shortcode", $post_id);
$footer_header = get_field("footer_header", $post_id);
$footer_header_color = get_field("footer_header_color", $post_id);
$footer_text = get_field("footer_text", $post_id);
if ( 'solid_color' == $choose_the_footer_background ) {
$style = 'background-color:' . $footer_background_color . ';';
} else if ( ! $footer_background_image ) {
$style = 'background: rgba(0, 0, 0, 0) url(\'' . $urlpath . 'assets/img/footer.jpg\') no-repeat scroll center center / cover ;';
} else {
$style = 'background: rgba(0, 0, 0, 0) url(\'' . $footer_background_image . '\') no-repeat scroll center center / cover ;';
}
?>
<div class="f" style="<?php echo $style; ?>">
<div class="container">
<div class="row centered mtb">
<h2 style="color:<?php echo $footer_header_color; ?>"><?php echo $footer_header; ?></h2>
<h5 style="color:<?php echo $footer_text_color; ?>"><?php echo $footer_text; ?></h5>
<div class="col-md-6 col-md-offset-3 mt">
<?php echo $footer_form_shortcode; ?>
</div><!--/col-md-6 -->
</div><!--/row -->
<?php
/* Start social_icons Repeater Output */
if ( have_rows( "social_icons" ) ) { ?>
<div class="col-md-6 col-md-offset-3">
<div class="social-icons">
<?php while ( have_rows( "social_icons" ) ) : the_row();
$social_icon = get_sub_field("social_icon");
$social_link = get_sub_field("social_link");
$social_icon_color = get_sub_field("social_icon_color");
$social_icon_hover_color = get_sub_field("social_icon_hover_color");
?>
<a href="<?php echo $social_link; ?>" style="color:<?php echo $social_icon_color ?>;"
onmouseover = "this.style.color = '<?php echo $social_icon_hover_color ?>';"
onmouseout = "this.style.color = '<?php echo $social_icon_color ?>';">
<i class="fa <?php echo $social_icon; ?>"></i>
</a>
<?php endwhile; ?>
</div>
</div>
<?php } /* end if have_rows(social_icons) */
/* End social_icons Repeater Output */
?>
</div><!--/container -->
</div><!--/f -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="<?php //echo LANDINGPAGES_URLPATH. 'templates/' . $key .'/assets/js/jquery.min.js' ?>"></script>
<script src="<?php //echo LANDINGPAGES_URLPATH. 'templates/' . $key .'/assets/js/bootstrap.min.js' ?>"></script>
<script src="<?php //echo LANDINGPAGES_URLPATH. 'templates/' . $key .'/assets/js/retina-1.1.0.js' ?>"></script>
<?php
do_action('lp_footer');
do_action('wp_footer');
?>
</body>
</html>
<?php
endwhile; endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment