-
Notifications
You must be signed in to change notification settings - Fork 0
/
front-page.php
223 lines (219 loc) · 7.53 KB
/
front-page.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?php
/**
* The template for displaying home page.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package Beri_cafe
*/
get_header();
$hideslide = get_theme_mod('hide_slides', 1);
$secwithcontent = get_theme_mod('hide_home_secwith_content', 1);
$hidesecone = get_theme_mod('hide_sectionone', 1);
if (!is_home() && is_front_page()) {
if( $hideslide == '') { ?>
<!-- Slider Section -->
<?php
$pages = array();
for($sld=7; $sld<10; $sld++) {
$mod = absint( get_theme_mod('page-setting'.$sld));
if ( 'page-none-selected' != $mod ) {
$pages[] = $mod;
}
}
if( !empty($pages) ) :
$args = array(
'posts_per_page' => 3,
'post_type' => 'page',
'post__in' => $pages,
'orderby' => 'post__in'
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) :
$sld = 7;
?>
<section id="home_slider">
<div class="slider-wrapper theme-default">
<div id="slider" class="nivoSlider">
<?php
$i = 0;
while ( $query->have_posts() ) : $query->the_post();
$i++;
$Beri_cafe_slideno[] = $i;
$Beri_cafe_slidedesc[] = get_the_excerpt();
$Beri_cafe_slidelink[] = esc_url(get_permalink());
?>
<img src="<?php the_post_thumbnail_url('full'); ?>" title="#slidecaption<?php echo esc_attr( $i ); ?>" />
<?php
$sld++;
endwhile;
?>
</div>
<?php
$k = 0;
foreach( $Beri_cafe_slideno as $Beri_cafe_sln ){ ?>
<div id="slidecaption<?php echo esc_attr( $Beri_cafe_sln ); ?>" class="nivo-html-caption">
<div class="slide_info">
<h2><?php echo esc_html($Beri_cafe_slidetitle[$k] ); ?></h2>
<p><?php echo esc_html($Beri_cafe_slidedesc[$k] ); ?></p>
<div class="clear"></div>
<a class="slide_more" href="<?php echo esc_url($Beri_cafe_slidelink[$k] ); ?>">
<?php esc_html_e('Read More', 'Beri_cafe');?>
</a>
</div>
</div>
<?php $k++;
wp_reset_postdata();
} ?>
<?php endif; endif; ?>
</div>
<div class="clear"></div>
</section>
<?php } }
?>
<?php
if (!is_home() && is_front_page()) {
if( $hidesecone == '') { ?>
<section class="homeone_section_area">
<div class="center">
<div class="homeone_section_content">
<?php
if( get_theme_mod('page-column1',false)) {
$sectiononequery = new WP_query('page_id='.get_theme_mod('page-column1',true));
while( $sectiononequery->have_posts() ) : $sectiononequery->the_post(); ?>
<div class="hm-leftcols">
<h2><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<a class="ReadMore" href="<?php the_permalink(); ?>"><?php echo esc_html_e('Read More', 'Beri_cafe');?></a>
</div>
<?php if( has_post_thumbnail() ) { ?>
<div class="hm-rightcols">
<?php the_post_thumbnail('full'); ?>
</div>
<?php } ?>
<?php endwhile;
wp_reset_postdata();
} ?>
<div class="clear"></div>
</div>
</div>
</section>
<?php } } ?>
<?php
if(!is_home() && is_front_page()){
if( $secwithcontent == '') {
?>
<section id="sectionone">
<div class="container">
<div class="home_section1_content">
<?php
$section2_title = get_theme_mod('section2_title');
if(!empty($section2_title)){
?>
<div class="center-title"><h2><?php echo esc_attr($section2_title); ?></h2></div>
<?php }
?>
<div class="row_area">
<?php
for($l=1; $l<5; $l++) {
if( get_theme_mod('sec-column-left'.$l,false)) {
$leftblock = new WP_query('page_id='.get_theme_mod('sec-column-left'.$l,true));
while( $leftblock->have_posts() ) : $leftblock->the_post();
?>
<a href="<?php echo esc_url( get_permalink() ); ?>"><div class="servicebox boxpattern-1">
<div class="serviceboxbg">
<?php if( has_post_thumbnail() ) { ?>
<div class="services-thumb"><?php the_post_thumbnail('full'); ?></div>
<?php } ?>
<div class="servicebox-content">
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
</div>
</div>
</div></a>
<?php endwhile; wp_reset_postdata();
}}
?>
</div>
</div>
</div>
</section>
<?php }} ?>
<div class="container">
<div class="page_content">
<?php
if ( 'posts' == get_option( 'show_on_front' ) ) {
?>
<section class="site-main">
<div class="blog-post">
<?php
if ( have_posts() ) :
// Start the Loop.
while ( have_posts() ) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
endwhile;
// Previous/next post navigation.
the_posts_pagination( array(
'mid_size' => 2,
'prev_text' => esc_html__( 'Back', 'Beri_cafe' ),
'next_text' => esc_html__( 'Next', 'Beri_cafe' ),
) );
else :
// If no content, include the "No posts found" template.
get_template_part( 'no-results', 'index' );
endif;
?>
</div>
<!-- blog-post -->
</section>
<?php
} else {
?>
<section class="site-main">
<div class="blog-post">
<?php
if ( have_posts() ) :
// Start the Loop.
while ( have_posts() ) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
?>
<header class="entry-header">
<h1><?php the_title(); ?></h1>
</header>
<?php
the_content();
endwhile;
// Previous/next post navigation.
the_posts_pagination( array(
'mid_size' => 2,
'prev_text' => esc_html__( 'Back', 'Beri_cafe' ),
'next_text' => esc_html__( 'Next', 'Beri_cafe' ),
) );
else :
// If no content, include the "No posts found" template.
get_template_part( 'no-results', 'index' );
endif;
?>
</div>
<!-- blog-post -->
</section>
<?php
}
?>
<?php get_sidebar();?>
<div class="clear"></div>
</div><!-- site-aligner -->
</div><!-- content -->
<?php get_footer(); ?>