File: /var/www/delta/wp-content/themes/delta/templates/acf-blocks/all-project-showcase/render.php
<?php
$taxonomy = 'delta_project_category';
$terms = get_terms($taxonomy);
$fields = get_fields();
$context = Timber::context();
$context["block"] = $block;
$context["fields"] = $fields;
$context["is_preview"] = $is_preview;
$context['taxonomy_terms'] = $terms;
$context["term_links"] = array();
array_push($context["term_links"], get_field('all_projects_page', 'options'));
foreach($terms as $term){
array_push($context["term_links"], get_field('projects_page', $term));
}
$args = array(
'post_type' => 'delta_project',
'paged' => get_query_var( 'paged' ),
'posts_per_page' => 10,
);
if ( !empty( $fields['project_category'] ) ) {
$args['tax_query'] = array(
array(
'taxonomy' => $taxonomy,
'field' => 'term_id',
'terms' => $fields['project_category'],
),
);
}
$context['posts'] = new Timber\PostQuery($args);
Timber::render( "/view.twig", $context );
?>