-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfront-page.php
More file actions
80 lines (66 loc) · 1.78 KB
/
front-page.php
File metadata and controls
80 lines (66 loc) · 1.78 KB
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
<?php
/**
* Front page template
*
* @package Scratch
* @author Carrie Dils
* @link http://www.carriedils.com/
* @copyright Copyright (c) 2015, Carrie Dils
* @license GPL-2.0+
*/
add_action( 'genesis_meta', 'scratch_home_page_setup' );
/**
* Set up the homepage layout by conditionally loading sections when widgets
* are active.
*
* @since 1.0.0
*/
function scratch_home_page_setup() {
$home_sidebars = array(
'home_welcome' => is_active_sidebar( 'home-welcome' ),
'call_to_action' => is_active_sidebar( 'call-to-action' ),
);
// Return early if no sidebars are active.
if ( ! in_array( true, $home_sidebars ) ) {
return;
}
// Add home welcome area if "Home Welcome" widget area is active.
if ( $home_sidebars['home_welcome'] ) {
add_action( 'genesis_after_header', 'scratch_add_home_welcome' );
}
// Add call to action area if "Call to Action" widget area is active.
if ( $home_sidebars['call_to_action'] ) {
add_action( 'genesis_after_header', 'scratch_add_call_to_action' );
}
// Force full-width-content layout setting.
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
// Remove posts.
remove_action( 'genesis_loop', 'genesis_do_loop' );
}
/**
* Display content for the "Home Welcome" section.
*
* @since 1.0.0
*/
function scratch_add_home_welcome() {
genesis_widget_area( 'home-welcome',
array(
'before' => '<div class="home-welcome"><div class="wrap">',
'after' => '</div></div>',
)
);
}
/**
* Display content for the "Call to Action" section.
*
* @since 1.0.0
*/
function scratch_add_call_to_action() {
genesis_widget_area( 'call-to-action',
array(
'before' => '<div class="call-to-action"><div class="wrap">',
'after' => '</div></div>',
)
);
}
genesis();