-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-pagebuilder.php
70 lines (46 loc) · 2.09 KB
/
template-pagebuilder.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Template Name: Pagebuilder
*/
get_header(); // Loads the header.php template. ?>
<?php
$layout_global = get_theme_mod('envince_sidebar','content-sidebar');
if(is_singular()){
$layout = get_post_meta( get_the_ID(), 'envince_sidebarlayout', 'default', true );
if(($layout == "default") || (empty($layout))){
$layout = $layout_global;
}
}
else {
$layout = $layout_global;
}
if ($layout == "sidebar-sidebar-content" ) {
hybrid_get_sidebar( 'secondary' ); // Loads the sidebar/secondary.php template.
}
if ($layout == "sidebar-content-sidebar" || $layout == "sidebar-sidebar-content" || $layout == "sidebar-content") {
hybrid_get_sidebar( 'primary' ); // Loads the sidebar/primary.php template.
}
?>
<main class="col-sm-12 <?php envince_main_layout_class(); ?>" <?php hybrid_attr( 'content' ); ?>>
<?php if ( have_posts() ) : // Checks if any posts were found. ?>
<?php while ( have_posts() ) : // Begins the loop through found posts. ?>
<?php the_post(); // Loads the post data. ?>
<?php locate_template( array( 'content/pagebuilder.php' ), true ); // Loads the content template when using with pagebuilder. ?>
<?php if ( is_singular() ) : // If viewing a single post/page/CPT. ?>
<?php comments_template( '', true ); // Loads the comments.php template. ?>
<?php endif; // End check for single post. ?>
<?php endwhile; // End found posts loop. ?>
<?php locate_template( array( 'misc/loop-nav.php' ), true ); // Loads the misc/loop-nav.php template. ?>
<?php else : // If no posts were found. ?>
<?php locate_template( array( 'content/error.php' ), true ); // Loads the content/error.php template. ?>
<?php endif; // End check for posts. ?>
</main><!-- #content -->
<?php
if ($layout == "sidebar-content-sidebar" || $layout == "content-sidebar-sidebar" || $layout == "content-sidebar") {
hybrid_get_sidebar( 'secondary' ); // Loads the sidebar/secondary.php template.
}
if ($layout == "content-sidebar-sidebar" ) {
hybrid_get_sidebar( 'primary' ); // Loads the sidebar/primary.php template.
}
?>
<?php get_footer(); // Loads the footer.php template. ?>