File: /var/www/hcv/wp-content/themes/hockey/pages/drill-set.php
<?php
/*
* Template Name: Drill set
*
*/
$context = Timber::context();
if(empty($_GET["id"])){
wp_die("Id not found.");
}else{
$drill_id = $_GET["id"];
}
$response = file_get_contents('https://api.hockeycoachvision.com/articles/shop');
$response = json_decode($response);
foreach ($response as $drill){
//Compare dates
if($drill->id == $drill_id){
$context['post'] = $drill;
}
}
$context['drill_store_page_template'] = get_field('drill_store_page_template', 'options');
Timber::render( array( 'pages/drill-set.twig', 'page.twig' ), $context );