forked from arnabwahid/wordpress-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 2
/
page-jumbotron.php
104 lines (67 loc) · 2.44 KB
/
page-jumbotron.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/*
Template Name: Full-width Jumbotron
*/
?>
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$post_thumbnail_id = get_post_thumbnail_id();
$featured_src = wp_get_attachment_image_src( $post_thumbnail_id, 'wpbs-featured-home' );
global $wheniwasbad_options;
$sidebar_position = get_post_meta($post->ID, 'sidebar_position' , true);
$sidebar_widget_group = get_post_meta($post->ID, 'sidebar_widgets' , true);
$hide_empty_sidebar = $wheniwasbad_options['hide_widgets'];
$jumbotron_contents = get_post_meta($post->ID, 'jumbotron_contents' , true);
$jumbotron_bg_color = get_post_meta($post->ID, 'jumbotron_bg_color' , true);
$jumbotron_bg_image = get_post_meta($post->ID, 'jumbotron_bg_image' , true);
if ( ! is_active_sidebar($sidebar_widget_group) && $hide_empty_sidebar) {
$main_class = "col-md-12";
$sidebar_class = "";
} else {
if ( $sidebar_position == 'left' ) {
$main_class = "col-md-9 col-md-push-3";
$sidebar_class = "col-md-3 col-md-pull-9";
} elseif ( $sidebar_position == 'right' ) {
$main_class = "col-md-9";
$sidebar_class = "col-md-3";
}
}
?>
<div id="content" class="content-no-margin clearfix">
<?php if ($jumbotron_contents != ''): ?>
<?php
if ($jumbotron_bg_image) {
$jumbotron_style = 'style="background-image: url(\'' . wp_get_attachment_url($jumbotron_bg_image) . '\'); background-repeat: no-repeat; background-position: 0 0; background-size: cover;\'"';
} elseif ($jumbotron_bg_color) {
$jumbotron_style = 'style="background-color: ' . $jumbotron_bg_color . '"';
}
?>
<div class="jumbotron" <?php echo $jumbotron_style; ?>>
<?php echo $jumbotron_contents;?>
</div>
<?php else: ?>
<div class="container clearfix">
<header class="page-header">
<h1><?php single_post_title(); ?></h1>
<?php get_template_part('postmeta-horizontal'); ?>
</header> <!-- end page header -->
</div>
<?php endif;?>
<div class="container">
<div class="row clearfix">
<section id="main" class="<?php echo $main_class; ?> clearfix" role="main">
<?php the_content(); ?>
</section> <!-- main -->
<?php if ($sidebar_class != ''): ?>
<section class="<?php echo $sidebar_class; ?> clearfix" role="aside">
<?php get_sidebar($sidebar_widget_group); ?>
</section>
<?php endif; ?>
</div>
</div> <!-- end #content -->
<?php endwhile; ?>
<?php else : ?>
<?php not_found(); ?>
<?php endif; ?>
<?php get_footer(); ?>