Last active
November 6, 2015 10:21
-
-
Save dn7734/9afa2a1ad4efe4ea8a65 to your computer and use it in GitHub Desktop.
wordpress sage front-page.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /* remove_filter ('the_content', 'wpautop'); */ ?> | |
<section class="slider"> | |
<div class="owl-carousel"> | |
<!-- owl-carousel include to assets/scripts/main.js | |
// JavaScript to be fired on all pages | |
$(".owl-carousel").owlCarousel({ | |
items:1 | |
}); | |
--> | |
<?php | |
// check if the repeater field has rows of data | |
if( have_rows('slide') ): | |
// loop through the rows of data | |
while ( have_rows('slide') ) : the_row(); | |
$image = get_sub_field('image'); | |
$title = get_sub_field('title'); | |
$url = get_sub_field('url'); | |
$content = get_sub_field('content'); | |
$size = 'large'; // (thumbnail, medium, large, full or custom size) | |
if( $image ) { ?> | |
<div class="card"> | |
<a href="<?php echo $url ; ?> | |
"> | |
<img src="<?php echo wp_get_attachment_image_src( $image, $size )[0] ; ?> | |
"> | |
<h2 class="heading"> | |
<?php echo $title ; ?></h2> | |
<div class="filter"> | |
<?php echo $content ; ?></div> | |
</a> | |
</div> | |
<?php } | |
endwhile; | |
else : | |
// no rows found | |
endif; | |
?></div> | |
</section> | |
<section class="masonry"> | |
<div class="container"> | |
<div class="row text-center"> | |
<h2 class="heading"> | |
<?php echo get_field('masonry_title'); ?></h2> | |
<!-- aaALERT !!!! --> | |
<hr style="color: #080;width: 25%;border: 1px solid;"> | |
<!-- aaALERT !!!! --> | |
<div class="filter"> | |
<?php echo get_field('masonry_text'); ?></div> | |
<?php | |
// check if the repeater field has rows of data | |
if( have_rows('masonry') ): | |
// loop through the rows of data | |
while ( have_rows('masonry') ) : the_row(); | |
$image = get_sub_field('masonry_image'); | |
$url = get_sub_field('masonry_post'); | |
$the_post = get_post( $url ); | |
$img_size = get_sub_field('masonry_img_size'); | |
?> | |
<?php | |
switch ($img_size) { | |
case '1*1': | |
$size_test = 'one-thumb'; | |
break; | |
case '1*2': | |
$size_test = 'two-thumb'; | |
break; | |
case '2*1': | |
$size_test = 'three-thumb'; | |
break; | |
case '2*2': | |
$size_test = 'four-thumb'; | |
break; | |
}?> | |
<div class="col-sm1-3"> | |
<a href="<?php echo $the_post-> | |
guid; ?> | |
"> | |
<div class="card" style="background-image:url(<?php echo wp_get_attachment_image_src( $image, $size_test )[0];?> | |
);"> | |
<!-- <hr style="color: #080;width: 25%;border: 1px solid;"> --> | |
<h4 class="heading"> | |
<?php echo $the_post->post_title; ?></h4> | |
</div> | |
</a> | |
</div> | |
<?php | |
endwhile; | |
else : | |
// no rows found | |
endif; | |
?></div> | |
</div> | |
</section> | |
<?php | |
$image = get_field('image'); | |
$size = 'large'; // (thumbnail, medium, large, full or custom size) | |
?> | |
<section class="hero_content" style="background-image:url(<?php echo wp_get_attachment_image_src( $image, $size )[0];?> | |
);"> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-sm-12 text-center"> | |
<?php | |
$posts = get_posts( array( | |
'numberposts' => | |
1, | |
'orderby' => 'post_date', | |
'order' => 'DESC', | |
'post_type' => 'testimonial', | |
'taxonomy' => 'testimonials', | |
) ); | |
foreach($posts as $post){ setup_postdata($post); ?> | |
<p>❝</p> | |
<h3 class="filter"> | |
<?php echo $post->post_title; ?></h3> | |
<p> | |
<?php echo $post->post_content; ?></p> | |
<?php } | |
wp_reset_postdata(); | |
?></div> | |
</div> | |
</div> | |
</section> | |
<section class="content_video"> | |
<div class="container"> | |
<div class="row text-center"> | |
<?php | |
$title = get_field('simple_title'); | |
$content = get_field('simple_content'); | |
?> | |
<div class="col-sm-12"> | |
<h2 class="heading text-center"> | |
<?php echo $title ?></h2> | |
<!-- <hr style="color: #080;width: 25%;border: 1px solid;"> --> | |
<div class="filter"> | |
<?php echo $content ?></div> | |
</div> | |
</div> | |
</div> | |
<div class="container"> | |
<div class="row"> | |
<?php | |
$posts = get_posts( array( | |
'numberposts' => | |
1, //posts_per_page | |
'orderby' => 'post_date', | |
'order' => 'DESC', | |
'post_type' => 'video', | |
'taxonomy' => 'videos', | |
) ); | |
foreach($posts as $post){ setup_postdata($post); | |
$video = get_field('content_video'); | |
$title = get_field('content_video_title'); | |
$content = get_field('content_video_text'); | |
?> | |
<div class="col-sm-6"> | |
<div class="heading"> | |
<?php echo $title; ?></div> | |
<div class="filter"> | |
<p> | |
<?php echo $post->post_content; ?></p> | |
</div> | |
</div> | |
<div class="col-sm-6"> | |
<div class="embed-responsive embed-responsive-16by9"> | |
<?php echo $video;?></div> | |
</div> | |
<?php } | |
wp_reset_postdata(); | |
?> | |
</div> | |
<button type="button" class="btn btn-default" aria-label="Left Align"> | |
<?php wp_list_categories('show_option_al=VIEW ALL VIDEOS&style=none&taxonomy=videos&title_li=0&include=13'); ?> | |
</button> | |
</div> | |
</section> | |
<section class="contact"> | |
<div class="container"> | |
<div class="row"> | |
<?php | |
$content = get_field('contact'); | |
?> | |
<div class="col-sm-6"> | |
<div class="heading"> | |
<?php echo $content ?></div> | |
</div> | |
<div class="col-sm-6"> | |
<?php echo do_shortcode( '[contact-form-7 id="40" title="Contact form 1"]' ); ?> | |
</div> | |
</div> | |
</div> | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment