-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate-builder.php
More file actions
85 lines (61 loc) · 2.59 KB
/
template-builder.php
File metadata and controls
85 lines (61 loc) · 2.59 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
global $avia_config, $post;
if ( post_password_required() )
{
get_template_part( 'page' ); exit();
}
/*
* get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
*/
get_header();
// set up post data
setup_postdata( $post );
//check if we want to display breadcumb and title
if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title();
do_action( 'ava_after_main_title' );
//filter the content for content builder elements
$content = apply_filters('avia_builder_precompile', get_post_meta(get_the_ID(), '_aviaLayoutBuilderCleanData', true));
//if user views a preview me must use the content because WordPress doesn't update the post meta field
if(is_preview())
{
$content = apply_filters('avia_builder_precompile', get_the_content());
}
//check first builder element. if its a section or a fullwidth slider we dont need to create the default openeing divs here
$first_el = isset(ShortcodeHelper::$tree[0]) ? ShortcodeHelper::$tree[0] : false;
$last_el = !empty(ShortcodeHelper::$tree) ? end(ShortcodeHelper::$tree) : false;
if(!$first_el || !in_array($first_el['tag'], AviaBuilder::$full_el ) )
{
echo avia_new_section(array('close'=>false,'main_container'=>true, 'class'=>'main_color container_wrap_first'));
}
$content = apply_filters('the_content', $content);
$content = apply_filters('avf_template_builder_content', $content);
echo $content;
$avia_wp_link_pages_args = apply_filters('avf_wp_link_pages_args', array(
'before' =>'<nav class="pagination_split_post">'.__('Pages:','avia_framework'),
'after' =>'</nav>',
'pagelink' => '<span>%</span>',
'separator' => ' ',
));
wp_link_pages($avia_wp_link_pages_args);
//only close divs if the user didnt add fullwidth slider elements at the end. also skip sidebar if the last element is a slider
if(!$last_el || !in_array($last_el['tag'], AviaBuilder::$full_el_no_section ) )
{
$cm = avia_section_close_markup();
echo "</div>";
echo "</div>$cm <!-- section close by builder template -->";
//get the sidebar
if (is_singular('post')) {
$avia_config['currently_viewing'] = 'blog';
}else{
$avia_config['currently_viewing'] = 'page';
}
get_sidebar();
}
else
{
echo "<div><div>";
}
echo avia_sc_section::$close_overlay;
echo ' </div><!--end builder template-->';
echo '</div><!-- close default .container_wrap element -->';
get_footer();