-
Notifications
You must be signed in to change notification settings - Fork 3
/
subpagina-projecte.php
55 lines (39 loc) · 1.68 KB
/
subpagina-projecte.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* Template Name: Subpàgina Projecte
*
* @package wp-softcatala
*/
$post_subpagina = new TimberPost();
$timberPost = new TimberPost( $post_subpagina->projecte );
$context_filter = new SC_ContextFilterer();
$context = $context_filter->get_filtered_context( array ( 'prefix_title' => $timberPost->title ) );
$context['sidebar_top'] = Timber::get_widgets('sidebar_top');
$context['sidebar_elements'] = array( 'static/dubte_forum.twig', 'baixades.twig', 'links.twig' );
$context['sidebar_bottom'] = Timber::get_widgets('sidebar_bottom');
$context['post_subpagina'] = $post_subpagina;
$context['post'] = $timberPost;
$context['current_url'] = get_current_url();
$logo = get_img_from_id( $timberPost->logotip );
$context['logotip'] = $logo;
$custom_logo_filter = function ($img) use($logo ) {
return $logo;
};
add_filter( 'wpseo_twitter_image', $custom_logo_filter);
add_filter( 'wpseo_opengraph_image', $custom_logo_filter);
$context['credits'] = $timberPost->get_field( 'credits' );
if ( is_array( $timberPost->responsable ) ) {
$context['responsables'] = get_users_metadata($timberPost->responsable);
} else {
$context['responsables'] = false;
}
//Contact Form Data
$context['contact']['to_email'] = 'web@softcatala.org';
$context['contact']['nom_from'] = 'Projectes de Softcatalà';
$context['contact']['assumpte'] = '[Projectes] Contacte des del formulari';
$query = array ( 'post_id' => $post_subpagina->projecte, 'subpage_type' => 'projecte' );
//Related subpages
$args = get_post_query_args( 'page', SearchQueryType::PageProjecte, $query );
query_posts($args);
$context['related_pages'] = Timber::get_posts($args);
Timber::render( array( 'subpagina-type.twig' ), $context );