G

template for FWP

public
Guest Jun 13, 2024 Never 22
Clone
Plaintext paste1.txt 48 lines (41 loc) | 1.03 KB
1
<?php
2
/**
3
*
4
* Methods for TimberHelper can be found in the /lib sub-directory
5
*
6
* @package WordPress
7
* @subpackage Timber
8
* @since Timber 0.1
9
*/
10
// new $WP_qu
11
$context = Timber::context();
12
13
$timber_post = Timber::get_post();
14
15
$keys = [
16
'search',
17
'count',
18
'reset',
19
'topic',
20
'course_level',
21
'delivery_method',
22
'location',
23
'schedule',
24
'date_range',
25
'price_range',
26
'certificate_program',
27
'certificate_program_taxonomy',
28
];
29
30
$facets = [];
31
32
foreach ( $keys as $key ) {
33
$shortcode = '[facetwp facet="' . $key . '"]';
34
$new_key = $key . '_output';
35
$facets[ $new_key ] = do_shortcode( $shortcode );
36
}
37
38
$template_output = do_shortcode( '[facetwp template="courses"]' );
39
$pager_output = do_shortcode( '[facetwp facet="pager_"]' );
40
41
$context = Timber::context( [
42
'post' => $timber_post,
43
'facets' => $facets,
44
'template' => $template_output,
45
'pager' => $pager_output,
46
] );
47
48
Timber::render( [ 'search/page-search-courses.twig', 'page.twig' ], $context );