-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfront-page.php
94 lines (62 loc) · 2.87 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
<?php
add_action( 'genesis_meta', 'gregr_home_widget_test' );
// Add widgets to homepage. If no widgets, then loop.
function gregr_home_widget_test() {
if ( is_active_sidebar( 'home-featured-full' ) || is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) || is_active_sidebar( 'home-middle-1' ) || is_active_sidebar( 'home-middle-2' ) || is_active_sidebar( 'home-middle-3' ) || is_active_sidebar( 'home-bottom' ) ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
add_action( 'genesis_after_header', 'gregr_home_do_featured' );
add_action( 'genesis_after_header', 'gregr_home_do_middle' );
add_action( 'genesis_after_header', 'gregr_home_do_bottom' );
}
}
// Home feature widget section
function gregr_home_do_featured() {
if ( is_active_sidebar( 'home-featured-full' ) || is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) ) {
echo '<section id="home-featured" class="clearfix"><div class="wrap">';
genesis_widget_area( 'home-featured-full', array(
'before' => '<main class="home-featured-full">',
'after' => '</main>',
) );
echo '<section id="home-featured-halves">';
genesis_widget_area( 'home-featured-left', array(
'before' => '<aside class="home-featured-left one-half first">',
'after' => '</aside>',
) );
genesis_widget_area( 'home-featured-right', array(
'before' => '<aside class="home-featured-right one half">',
'after' => '</aside>',
) );
echo '</section><!-- end home-featured-halves --></div><!-- end wrap --></section><!-- end home-featured -->'."\n";
}
}
// Home middle widget section
function gregr_home_do_middle() {
if ( is_active_sidebar( 'home-middle-1' ) || is_active_sidebar( 'home-middle-2' ) || is_active_sidebar( 'home-middle-3' ) ) {
echo '<section id="home-middle" class="clearfix"><div class="wrap">';
genesis_widget_area( 'home-middle-1', array(
'before' => '<aside class="home-middle-1 widget-area">',
'after' => '</aside>',
) );
genesis_widget_area( 'home-middle-2', array(
'before' => '<aside class="home-middle-2 widget-area">',
'after' => '</aside>',
) );
genesis_widget_area( 'home-middle-3', array(
'before' => '<aside class="home-middle-3 widget-area">',
'after' => '</aside>',
) );
echo '</div><!-- end wrap --></section><!-- end home-middle -->'."\n";
}
}
// Home bottom widget section
function gregr_home_do_bottom() {
if ( is_active_sidebar( 'home-bottom' ) ) {
echo '<section id="home-bottom" class="clearfix"><div class="wrap">';
genesis_widget_area( 'home-bottom', array(
'before' => '<aside class="home-bottom">',
) );
echo '</div><!-- end .wrap --></section><!-- end #home-bottom -->'."\n";
}
}
genesis();