-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmodules-template.php
More file actions
66 lines (50 loc) · 1.39 KB
/
modules-template.php
File metadata and controls
66 lines (50 loc) · 1.39 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
<?php
/**
* The template for displaying Modular Page Builder Template.
*
* Template Name: Modular Template
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package bigbang
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
$layouts = $page_layouts;
foreach ($layouts as $layout) {
$layout_names[] = $layout['name'];
}
if ( have_rows('modules') ):
while ( have_rows('modules') ) : the_row();
foreach ($layout_names as $layout_name){
if ( get_row_layout() == $layout_name ) {
$module_path = locate_template( $GLOBALS['framework_path'] . '/modules/template-' . str_replace('_', '-', $layout_name) . '.php' );
if ( !empty( $module_path ) ) {
include( $module_path );
}
}
}
endwhile;
else : ?>
<section class="module module-noncontent">
<div class="container">
<h2><?php echo __( "Sorry. We don't have any content available yet. :(", "bigbang" ); ?></h2>
</div>
</section>
<?php
endif;
// Default WP Content Field.
wp_reset_postdata(); // Restore original Post Data from modules.
if ( !empty( get_the_content() ) ) { ?>
<section class="module module-default">
<div class="container">
<?php the_content(); ?>
</div>
</section>
<?php } ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();