-
Notifications
You must be signed in to change notification settings - Fork 0
/
front-page.php
239 lines (163 loc) · 8.44 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<?php
/**
* This file adds the Home Page to the Aspire Theme.
*
* @author Appfinite
* @package Aspire
* @subpackage Customizations
*/
add_action( 'genesis_meta', 'aspire_front_page_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function aspire_front_page_genesis_meta() {
if ( is_active_sidebar( 'front-page-1' ) || is_active_sidebar( 'front-page-2' ) || is_active_sidebar( 'front-page-3' ) || is_active_sidebar( 'front-page-4' ) || is_active_sidebar( 'home-mid-left' ) || is_active_sidebar( 'home-mid-right' ) || is_active_sidebar( 'home-mid-wide' ) || is_active_sidebar( 'front-page-5' ) || is_active_sidebar( 'front-page-6' ) || is_active_sidebar( 'front-page-7' ) || is_active_sidebar( 'front-page-8' ) || is_active_sidebar( 'front-page-9' ) || is_active_sidebar( 'front-page-10' ) || is_active_sidebar( 'front-page-11' ) || is_active_sidebar( 'front-page-12' ) || is_active_sidebar( 'front-page-13' )) {
//* Enqueue scripts
add_action( 'wp_enqueue_scripts', 'aspire_enqueue_aspire_script' );
function aspire_enqueue_aspire_script() {
wp_enqueue_script( 'aspire-script', get_bloginfo( 'stylesheet_directory' ) . '/js/home.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_script( 'localScroll', get_stylesheet_directory_uri() . '/js/jquery.localScroll.min.js', array( 'scrollTo' ), '1.2.8b', true );
wp_enqueue_script( 'scrollTo', get_stylesheet_directory_uri() . '/js/jquery.scrollTo.min.js', array( 'jquery' ), '1.4.5-beta', true );
}
//* Enqueue parallax script
add_action( 'wp_enqueue_scripts', 'aspire_enqueue_parallax_script' );
function aspire_enqueue_parallax_script() {
if ( ! wp_is_mobile() ) {
wp_enqueue_script( 'parallax-script', get_bloginfo( 'stylesheet_directory' ) . '/js/parallax.js', array( 'jquery' ), '1.0.0' );
}
}
//* Add front-page body class
add_filter( 'body_class', 'aspire_body_class' );
function aspire_body_class( $classes ) {
$classes[] = 'front-page';
return $classes;
}
//* Remove breadcrumbs
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
//* Add homepage widgets
add_action( 'genesis_after_header', 'aspire_front_page_widgets' );
add_action( 'genesis_after_header', 'aspire_front_page_widgets_mid' );
add_action( 'genesis_after_header', 'aspire_front_page_widgets_bottom' );
$journal = get_option( 'aspire_journal_setting', 'true' );
if ( $journal === 'true' ) {
//* Add opening markup for blog section
add_action( 'genesis_before_loop', 'aspire_front_page_blog_open' );
//* Add closing markup for blog section
add_action( 'genesis_after_loop', 'aspire_front_page_blog_close' );
} else {
//* Force full width content layout
add_filter( 'genesis_site_layout', '__genesis_return_full_width_content' );
//* Remove the default Genesis loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
//* Remove .site-inner
add_filter( 'genesis_markup_site-inner', '__return_null' );
add_filter( 'genesis_markup_content-sidebar-wrap_output', '__return_false' );
add_filter( 'genesis_markup_content', '__return_null' );
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
}
//* Add featured-section body class
if ( is_active_sidebar( 'front-page-1' ) ) {
//* Add image-section-start body class
add_filter( 'body_class', 'aspire_featured_body_class' );
function aspire_featured_body_class( $classes ) {
$classes[] = 'featured-section';
return $classes;
}
}
}
}
//* Add markup for front page widgets
function aspire_front_page_widgets() {
genesis_widget_area( 'front-page-1', array(
'before' => '<div id="front-page-1" class="front-page-1"><div class="fp1 image-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
genesis_widget_area( 'front-page-2', array(
'before' => '<div id="front-page-2" class="front-page-2"><div class="image-section"><div class="flexible-widgets widget-area"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
genesis_widget_area( 'front-page-3', array(
'before' => '<div id="front-page-3" class="front-page-3"><div class="solid-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
genesis_widget_area( 'front-page-4', array(
'before' => '<div id="front-page-4" class="front-page-4"><div class="image-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
}
//* Add markup for front page widgets
function aspire_front_page_widgets_mid() {
if ( is_active_sidebar( 'home-mid-left' ) || is_active_sidebar( 'home-mid-right' ) ) {
echo '<div class="home-mid"><div class="wrap">';
genesis_widget_area( 'home-mid-left', array(
'before' => '<div id="home-mid-left" class="home-mid-left fadeup-effect"><div class="wrap">',
'after' => '</div></div>',
) );
genesis_widget_area( 'home-mid-right', array(
'before' => '<div id="home-mid-right" class="home-mid-right fadeup-effect"><div class="wrap">',
'after' => '</div></div>',
) );
echo '</div><!-- end .wrap --></div><!-- end .home-mid -->';
}
genesis_widget_area( 'home-mid-wide', array(
'before' => '<div id="home-mid-wide" class="home-mid-wide"><div class="solid-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
}
//* Add markup for front page widgets
function aspire_front_page_widgets_bottom() {
genesis_widget_area( 'front-page-5', array(
'before' => '<div id="front-page-5" class="front-page-5"><div class="image-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
genesis_widget_area( 'front-page-6', array(
'before' => '<div id="front-page-6" class="front-page-6"><div class="solid-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
genesis_widget_area( 'front-page-7', array(
'before' => '<div id="front-page-7" class="front-page-7"><div class="image-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
genesis_widget_area( 'front-page-8', array(
'before' => '<div id="front-page-8" class="front-page-8"><div class="solid-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
genesis_widget_area( 'front-page-9', array(
'before' => '<div id="front-page-9" class="front-page-9"><div class="image-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
genesis_widget_area( 'front-page-10', array(
'before' => '<div id="front-page-10" class="front-page-10"><div class="solid-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
genesis_widget_area( 'front-page-11', array(
'before' => '<div id="front-page-11" class="front-page-11"><div class="image-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
genesis_widget_area( 'front-page-12', array(
'before' => '<div id="front-page-12" class="front-page-12"><div class="image-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
genesis_widget_area( 'front-page-13', array(
'before' => '<div id="front-page-13" class="front-page-13"><div class="solid-section"><div class="flexible-widgets widget-area fadeup-effect"><div class="wrap">',
'after' => '</div></div></div></div>',
) );
}
//* Add opening markup for blog section
function aspire_front_page_blog_open() {
$journal_text = get_option( 'aspire_journal_text', __( 'Latest From the Blog', 'aspire' ) );
if ( 'posts' == get_option( 'show_on_front' ) ) {
echo '<div id="journal" class="widget-area"><div class="wrap">';
if ( ! empty( $journal_text ) ) {
echo '<h2 class="widgettitle widget-title journal-title">' . $journal_text . '</h2><hr>';
}
}
}
//* Add closing markup for blog section
function aspire_front_page_blog_close() {
if ( 'posts' == get_option( 'show_on_front' ) ) {
echo '</div></div>';
}
}
genesis();