File: /var/www/tana/wp-content/themes/tana/page-templates/know-how.php
<?php
/*
* Template Name: Know How
*
*/
?>
<?php
if ( !is_ajax() ) :
get_header();
endif;
$id = $_POST['page-id'];
?>
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="row">
<div class="col-xs-6 col-xs-offset-3 col-sm-2 col-sm-offset-0 col-sm-18">
<a href="<?= home_url() ?>">
<?php
$logo = get_field( 'page_logotype', $id );
?>
<img class="logo--secondary img-responsive center-block" src="<?= $logo['url'] ?>" alt="<?= $logo['alt'] ?>">
</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-2 col-sm-18 sticky-follow">
<div>
<div>
<a href="./">
<img class="logo--secondary img-responsive center-block" src="<?= $logo['url'] ?>" alt="<?= $logo['alt'] ?>">
</a>
</div>
<ul class="list list--unstyled list-categories list-categories--pretty">
<?php
$categories = get_terms( 'category' );
foreach( $categories as $category ) :
?>
<li class="list-categories__item" data-type="<?= $category->term_id ?>" data-category-name="<?= strtolower($category->name) ?>"><?= $category->name ?></li>
<?php endforeach; ?>
<li class="list-categories__item" data-type="links" data-category-name="links" href="#links-grid">Links</li>
</ul>
</div>
</div>
<div class="col-sm-10 col-sm-82">
<div class="results-container">
<div class="articles-grid">
<div class="row">
<div class="col-sm-6 col-md-8 faded">
<?php
$featured = get_field( 'featured_post', $id );
if( $featured == 'latest' ) :
$_post = new WP_Query(array(
'posts_per_page' => 1,
'orderby' => 'publish_date',
'order' => 'DESC'
));
if( $_post->have_posts() ) :
while( $_post->have_posts() ) :
$_post->the_post();
$first = $_post->posts[0]->ID;
require_once( get_template_directory() . '/partials/post-short.php' );
endwhile;
endif;
elseif( $featured == 'choose' ) :
$_post = get_field( 'choose_featured_post', $id );
if( $_post ) :
$post = $_post;
$first = $post->ID;
setup_postdata( $post );
require_once( get_template_directory() . '/partials/post-short.php' );
wp_reset_postdata();
endif;
endif;
?>
</div>
<?php
$_posts = new WP_Query(array(
'posts_per_page' => 7,
'orderby' => 'publish_date',
'order' => 'DESC',
'post__not_in' => array( $first )
));
if( $_posts->have_posts() ) :
while ( $_posts->have_posts() ) :
$_posts->the_post();?>
<div class="col-sm-6 col-md-4 faded">
<?php include( get_template_directory() . '/partials/post-short.php' ); ?>
</div>
<?php
endwhile;
wp_reset_postdata();
endif;
?>
</div>
</div>
<?php $index = 1; ?>
</div>
</div>
</div>
</div>
</div>
<?php
if ( !is_ajax() ) : ?>
<div class="content-wrapper-second">
</div>
<?php get_footer();
endif;
?>
</div>