-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhomepage.php
332 lines (277 loc) · 13.9 KB
/
homepage.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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
<?php
/*
Template Name: Home
*/
?>
<?php get_header(); ?>
<?php
if ( function_exists( 'get_option_tree') ) {
$home_sliderlayout = get_option_tree( 'value_homesliderlayout' );
$home_slidertext = get_option_tree( 'text_homeslider' );
$home_portfoliolayout = get_option_tree( 'value_homeportfoliolayout' );
$home_portfoliocount = get_option_tree( 'value_homeportfoliocount' );
$home_portfoliotitle = get_option_tree( 'text_homeportfoliotitle' );
$home_portfoliotitletagtext = get_option_tree( 'text_homeportfoliolinktext' );
$home_portfoliotitletagurl = get_option_tree( 'text_homeportfoliolinkurl' );
$home_newstextlayout = get_option_tree( 'value_newstextlayout' );
$home_newscount = get_option_tree( 'value_homenewscount' );
$home_newstitle = get_option_tree( 'text_homenewstitle' );
$home_newstitletagtext = get_option_tree( 'text_homenewslinktext' );
$home_newstitletagurl = get_option_tree( 'text_homenewslinkurl' );
$home_texttitle = get_option_tree( 'text_homeabouttitle' );
$home_abouttitletagtext = get_option_tree( 'text_homepageaboutlinktext' );
$home_abouttitletagurl = get_option_tree( 'text_homepageaboutlinkurl' );
}
$templateurl = get_template_directory_uri();
$pagecustoms = getOptions();
if (isset($pagecustoms["header_title"])){$apex_htitle = $pagecustoms['header_title'];}else{$apex_htitle = "";}
if (isset($pagecustoms["sidebar_orientation"])){$apex_sideo = $pagecustoms['sidebar_orientation'];}else{$apex_sideo = 1;}
if ($apex_sideo == 0){$conorient = "right"; $sideoffset = ""; $conoffset = "offset-by-one";}else{$conorient = "left"; $sideoffset = "offset-by-one"; $conoffset = "";}
if (isset($pagecustoms["sidebar"])){$apex_sidebar = $pagecustoms["sidebar"];}else{$apex_sidebar = "Page Sidebar";}
if (isset($pagecustoms["portfolio_category"])){
$ptype = $pagecustoms['portfolio_category'];
$pcat = "category_".$ptype;
}
if (isset($pagecustoms["portfolio_layout"])){$apex_foliolayout = $pagecustoms['portfolio_layout'];}else{$apex_foliolayout = 0;}
if ($apex_foliolayout == 0){$foliocolumns = "four"; $foliocolumnsnum = 4; $folioteasers = "teasers";}else{$foliocolumns = "eight"; $foliocolumnsnum = 2; $folioteasers = "teasers_large";}
if (isset($pagecustoms["portfolio_alpha"])){ if($pagecustoms['portfolio_alpha']!=""){$apex_folioalpha = $pagecustoms['portfolio_alpha'];}else{$apex_folioalpha = 0;}}else{
$apex_folioalpha = 0;}
?>
<!-- Slider
================================================== -->
<div class="sixteen columns row">
<?php
if ( function_exists( 'get_option_tree' ) ) {
$slides = get_option_tree( 'slider_home', '', false, true, -1 );
if ($home_sliderlayout=="With Text"){
echo '<div class="twelve columns alpha"><div class="flexslider clearfix"><ul class="slides">';
foreach( $slides as $slide ) {
if($slide['image']==""){
$slide['image'] = $templateurl.'/images/demo/700x350.jpg';
}
if($slide['description']!=null){
if($slide['link']==""){
echo '<li><img src="'.$slide['image'].'" alt="'.$slide['title'].'"/><p class="flex-caption">'.$slide['description'].'</p></li>';
}else{
echo '<li><a href="'.$slide['link'].'"><img src="'.$slide['image'].'" alt="'.$slide['title'].'"/></a><p class="flex-caption">'.$slide['description'].'</p></li>';
}
}else{
if($slide['link']==""){
echo '<li><img src="'.$slide['image'].'" alt="'.$slide['title'].'"/></li>';
}else{
echo '<li><a href="'.$slide['link'].'"><img src="'.$slide['image'].'" alt="'.$slide['title'].'"/></a></li>';
}
}
}
echo '</ul></div></div>';
echo '<div class="four columns omega slidertext">'.$home_slidertext.'</div>';
}else if ($home_sliderlayout=="Full"){
echo '<div class="flexslider clearfix"><ul class="slides">';
foreach( $slides as $slide ) {
if($slide['image']==""){
$slide['image'] = $templateurl.'/images/demo/940x350.jpg';
}
if($slide['description']!=null){
if($slide['link']==""){
echo '<li><img src="'.$slide['image'].'" alt="'.$slide['title'].'"/><p class="flex-caption">'.$slide['description'].'</p></li>';
}else{
echo '<li><a href="'.$slide['link'].'"><img src="'.$slide['image'].'" alt="'.$slide['title'].'"/></a><p class="flex-caption">'.$slide['description'].'</p></li>';
}
}else{
if($slide['link']==""){
echo '<li><img src="'.$slide['image'].'" alt="'.$slide['title'].'"/></li>';
}else{
echo '<li><a href="'.$slide['link'].'"><img src="'.$slide['image'].'" alt="'.$slide['title'].'"/></a></li>';
}
}
}
echo '</ul></div><div class="sliderspacefix"></div>';
}
}
?>
</div>
<?php if ($home_portfoliolayout!="Off") { ?>
<!-- Portfolio
================================================== -->
<div class="sixteen columns row divide">
<h3 class="titledivider"><?php echo $home_portfoliotitle ?></h3>
<?php if($home_portfoliotitletagtext!=""){ echo '<div class="rightlink"><a href="'.$home_portfoliotitletagurl.'" class="titlelink">'.$home_portfoliotitletagtext.'</a></div>'; } ?>
<div class="dividerline"></div>
</div>
<?php
$args=array(
'post_type' => $ptype,
'posts_per_page' => $home_portfoliocount
);
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query($args);
$terms = get_terms($pcat);
?>
<!-- Portfolio Filters
================================================== -->
<?php if ($home_portfoliolayout=="No Categories") {
echo '<div class="sixteen columns row portfolio_filter" style="display: none;">';
} else if ($home_portfoliolayout=="Categories") {
echo '<div class="sixteen columns row portfolio_filter">';
} ?>
<ul>
<?php
echo '<li><a class="portfolio_selector" data-group="all-group" href="#">'.__('All Projects', 'apex').'</a><span>|</span></li>';
foreach ( $terms as $term ) {
$filter_last_item = end($terms);
if($term!=$filter_last_item){
echo '<li><a class="portfolio_selector" data-group="'.strtolower(str_replace(" ", "-", $term->name)).'" href="#">'.$term->name.'</a><span>|</span></li>';
}else{
echo '<li><a class="portfolio_selector" data-group="'.strtolower(str_replace(" ", "-", $term->name)).'" href="#">'.$term->name.'</a></li>';
}
}
?>
</ul>
</div><div class="clear"></div>
<!-- Portfolio Teasers
================================================== -->
<div class="sixteen columns row <?php echo $folioteasers ?> portfolio">
<?php if ($wp_query->have_posts()) : ?>
<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
<?php
$custom = get_post_custom($post->ID);
$foliocatlist = get_the_term_list( $post->ID, $pcat, '', ', ', '' );
$entrycategory = get_the_term_list( $post->ID, $pcat, '', '_', '' );
$entrycategory = strip_tags($entrycategory);
$entrycategory = strtolower($entrycategory);
$entrycategory = str_replace(' ', '-', $entrycategory);
$entrycategory = str_replace('_', ' ', $entrycategory);
$entrytitle = get_the_title();
$blogimageurl = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
if($blogimageurl==""){
$blogimageurl = $templateurl.'/images/demo/460x272.jpg';
}
?>
<div class="<?php echo $foliocolumns ?> columns teaser all-group <?php echo $entrycategory ?>">
<a href="<?php the_permalink(); ?>" data-text="» <?php _e('Visit Project', 'apex'); ?>" class="hovering"><?php echo '<img src="'.get_template_directory_uri().'/functions/thumb.php?src='.$blogimageurl.'&h=272&w=460&zc=1" alt="" class="scale-with-grid" />'; ?></a>
<div class="pluswrap">
<a href="<?php the_permalink(); ?>" class="bigplus"></a>
<div class="topline"><a href="<?php the_permalink(); ?>"><?php echo $entrytitle ?></a></div>
<div class="subline"><?php echo $foliocatlist ?></div>
</div>
</div>
<?php endwhile; ?>
<?php else : ?>
<div class="eleven columns row alpha">
<p><?php _e('Oops, we could not find what you were looking for...', 'apex'); ?></p>
</div>
<?php endif; ?>
<?php
$wp_query = null;
$wp_query = $temp;
wp_reset_query();
?>
<div class="clear"></div>
</div><div class="clear"></div>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('.portfolio<?php echo $foliocolumnsnum ?>column').tpportfolio({
speed:500,
row:<?php echo $foliocolumnsnum ?>,
nonSelectedAlpha:<?php echo $apex_folioalpha ?>,
portfolioContainer:'.portfolio'
});
});
</script>
<?php } ?>
<?php if ($home_newstextlayout=="News And Text") { ?>
<!-- News
================================================== -->
<div class="eight columns row">
<div class="eight columns divide alpha">
<h3 class="titledivider"><?php echo $home_newstitle ?></h3>
<?php if($home_newstitletagtext!=""){ echo '<div class="rightlink"><a href="'.$home_newstitletagurl.'" class="titlelink">'.$home_newstitletagtext.'</a></div>'; } ?>
<div class="dividerlinehalf"></div>
</div>
<div class="eight columns alpha">
<?php
$newsargs = array( 'numberposts' => $home_newscount, 'orderby' => 'post_date', 'post_type' => 'post' );
$newslist = get_posts( $newsargs );
foreach ($newslist as $newspost) : setup_postdata($newspost);
$newscategory = get_the_category($newspost->ID);
$newsfirst_category = $newscategory[0]->cat_name;
$newsrepl = strtolower((preg_replace('/\s+/', '-', $newsfirst_category)));
$newsbase = home_url();
$newsimageurl = wp_get_attachment_url( get_post_thumbnail_id($newspost->ID) );
$newsexcerpt = excerpt(15);
/*$newsexcerpt = $newspost->post_excerpt;*/
echo '<div class="eight columns alpha newsteaser row">';
if ($newsimageurl != "") {
echo '<a href="'.$newsbase.'/'.$newsrepl.'/'.$newspost->post_name.'" class="borderhover"><img src="'.get_template_directory_uri().'/functions/thumb.php?src='.$newsimageurl.'&h=75&w=75&zc=1" alt=""/></a>';
}
if ($newsimageurl != "") {
echo '<div class="topline"><a href="'.$newsbase.'/'.$newsrepl.'/'.$newspost->post_name.'">'.$newspost->post_title.'</a></div><div class="subline">'.date_i18n(get_option('date_format'), strtotime($newspost->post_date_gmt)).'</div>';
echo '<div class="newsexcerpt">'.$newsexcerpt.'</div></div>';
}else{
echo '<div class="topline" style="margin-left:0;"><a href="'.$newsbase.'/'.$newsrepl.'/'.$newspost->post_name.'">'.$newspost->post_title.'</a></div><div class="subline" style="margin-left:0;">'.date_i18n(get_option('date_format'), strtotime($newspost->post_date_gmt)).'</div>';
echo '<div class="newsexcerpt" style="margin-left:0;">'.$newsexcerpt.'</div></div>';
}
endforeach;
?>
</div>
</div>
<!-- Info Text
================================================== -->
<div class="eight columns row">
<div class="eight columns divide alpha">
<h3 class="titledivider"><?php echo $home_texttitle ?></h3>
<?php if($home_abouttitletagtext!=""){ echo '<div class="rightlink"><a href="'.$home_abouttitletagurl.'" class="titlelink">'.$home_abouttitletagtext.'</a></div>'; } ?>
<div class="dividerlinehalf"></div>
</div>
<div class="eight columns alpha">
<?php if(have_posts()) : while(have_posts()) : the_post(); the_content(); endwhile; endif; ?><div class="clear"></div>
</div>
</div>
<?php } else if ($home_newstextlayout=="Text And Sidebar") { ?>
<!-- Text Content With Sidebar
================================================== -->
<div class="sixteen columns row divide">
<h3 class="titledivider"><?php echo $home_texttitle ?></h3>
<?php if($home_abouttitletagtext!=""){ echo '<div class="rightlink"><a href="'.$home_abouttitletagurl.'" class="titlelink">'.$home_abouttitletagtext.'</a></div>'; } ?>
<div class="dividerline"></div>
</div>
<!-- Content Holder
================================================== -->
<div class="eleven columns <?php echo $conoffset ?> row <?php echo $conorient ?> content" style="padding-top:0;">
<?php if(have_posts()) : while(have_posts()) : the_post(); the_content(); endwhile; endif; ?><div class="clear"></div>
</div>
<!-- Sidebar
================================================== -->
<div class="four columns sidebar <?php echo $sideoffset ?> content" style="padding-top:0;">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar($apex_sidebar) ) : ?>
<div class="widget">
<h5>Sidebar Widget Area</h5>
<div>
Please configure this Widget Area in the Admin Panel under Appearance -> Widgets
</div>
<div class="clear"></div>
</div>
<?php endif; ?>
<div class="clear"></div>
</div>
<?php } else if ($home_newstextlayout=="Full Text") { ?>
<!-- Full Text Content
================================================== -->
<div class="sixteen columns row divide">
<h3 class="titledivider"><?php echo $home_texttitle ?></h3>
<?php if($home_abouttitletagtext!=""){ echo '<div class="rightlink"><a href="'.$home_abouttitletagurl.'" class="titlelink">'.$home_abouttitletagtext.'</a></div>'; } ?>
<!--<div class="dividerline"></div>-->
</div>
<!-- Content Holder
================================================== -->
<div class="sixteen columns row">
<?php if(have_posts()) : while(have_posts()) : the_post(); the_content(); endwhile; endif; ?><div class="clear"></div>
</div>
<?php } else {?>
<!-- Space Adjuster
================================================== -->
<div class="sixteen columns bottomadjust"></div><div class="clear"></div>
<?php } ?>
<?php get_footer(); ?>