-
Notifications
You must be signed in to change notification settings - Fork 21
/
front-page.php
36 lines (25 loc) · 942 Bytes
/
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
<?php
//* Widgetized Front Page
//* =============================================================== */
//* Only widgetize if there are widgets in the right widget areas
if ( is_active_sidebar( 'home-featured' ) || is_active_sidebar( 'home-middle-feed' ) ) {
//* Remove the default Genesis loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
//* Run the widget loop ( see the loop below )
add_action( 'genesis_loop', 'ck_widget_loop' );
}
function ck_widget_loop() {
//* Define our widget areas and add them to array
$widgets = array(
'home-featured',
'home-middle-feed'
);
//* Run a foreach loop based on the array of widgets. This lets us avoid coding the same function more than once
foreach( $widgets as $widget ) {
genesis_widget_area( $widget, array(
'before' => '<div class="' . $widget . ' widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}
}
genesis();