Skip to content

Instantly share code, notes, and snippets.

@billyboozer
Created September 26, 2014 20:09
Show Gist options
  • Save billyboozer/f029aa6935a57b77f877 to your computer and use it in GitHub Desktop.
Save billyboozer/f029aa6935a57b77f877 to your computer and use it in GitHub Desktop.
<?php
/*
Template Name: Company
*/
?>
<?php
/*
* get a field value from the current post
*/
$value = get_field( "layout_type" );
if( $value == 'full' )
{
$image = get_field('full_image');
$mobile_image = get_field('full_mobile_image');
$copy = get_field('full_copy');
$full_section = '<div class="full">
<div class="full-image">
<img src="'. $image .'" alt="">
</div>
<div class="full-mobile-image">
<img src="'. $mobile_image .'" alt="">
</div>
<div class="full-copy">
'. $copy .'
</div>
</div>';
echo $full_section;
}
if ( $value == 'half' )
{
}
if ( $value == 'horizontal' )
{
$title = get_field('horizontal_title');
$sub = get_field('horizontal_subtitle');
$copy = get_field('horizontal_main_text');
$image = get_field('horizontal_image');
$mobile_image = get_field('horizontal_mobile_image');
$copy = get_field('full_copy');
$horizontal_section = '<div class="horizontal">
<div class="full-copy">
'. $copy .'
</div>
<div class="full-image">
<img src="'. $image .'" alt="">
</div>
<div class="full-mobile-image">
<img src="'. $mobile_image .'" alt="">
</div>
</div>';
echo $horizontal_section;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment