-
Notifications
You must be signed in to change notification settings - Fork 0
/
front-page.php
172 lines (132 loc) · 4.59 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
<?php
/**
* Digital Nomad Theme
*
* This file adds the home page to the Digital Nomad theme.
*
* @package Digital Nomad Theme
* @author thebrandiD
* @license GPL-2.0+
* @link https://thebrandidthemes.com/
*/
add_filter( 'genesis_site_title_wrap', 'digital_nomad_h1_for_site_title' );
/**
* Use h1 for site title.
*
* @param string $wrap site title.
* @return $wrap force h1.
*/
function digital_nomad_h1_for_site_title( $wrap ) {
return 'h1';
}
add_action( 'genesis_meta', 'digital_nomad_front_page_genesis_meta' );
function digital_nomad_front_page_genesis_meta() {
$home_widgets_active = false;
if ( is_active_sidebar( 'front-page-welcome' ) || is_active_sidebar( 'front-page-block-1' ) || is_active_sidebar( 'front-page-grid' ) || is_active_sidebar( 'front-page-testimonials' ) || is_active_sidebar( 'front-page-blog' ) || is_active_sidebar( 'front-page-cta' ) || is_active_sidebar( 'front-page-block-2' )) {
$home_widgets_active = true;
// Remove .site-inner's .wrap from front page.
add_theme_support( 'genesis-structural-wraps', array(
'header',
'nav',
'subnav',
'footer-widgets',
'footer-widget-1',
'footer-widget-2',
'footer',
) );
//* Force full width content layout
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
//* Remove breadcrumbs
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
//* Remove the default Genesis loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
// Update header for home page.
add_action( 'genesis_before_header', 'digital_nomad_before_header' );
// add_action( 'genesis_header', 'digital_nomad_home_hero', 15 );
add_action( 'genesis_after_header', 'digital_nomad_after_header' );
//* Add homepage widgets
add_action( 'genesis_loop', 'digital_nomad_front_page_widgets' );
}
//* Add featured-section body class
if ( ! is_active_sidebar( 'front-page-welcome' ) ) {
//* Add image-section-start body class
add_filter( 'body_class', 'digital_nomad_featured_body_class' );
function digital_nomad_featured_body_class( $classes ) {
$classes[] = 'no-featured-section';
return $classes;
}
}
if ( ! $home_widgets_active) {
//* Add image-section-start body class
add_filter( 'body_class', 'digital_nomad_featured_body_class_widgets' );
function digital_nomad_featured_body_class_widgets( $classes ) {
$classes[] = 'home-widgets-inactive';
return $classes;
}
}
}
//* Add markup for front page widgets
function digital_nomad_front_page_widgets() {
// Output remaining widget content.
echo '<h2 class="genesis-content-title screen-reader-text">Main Content Area</h2>';
genesis_widget_area( 'front-page-welcome', array(
'before' => '<div class="front-page-welcome image-section widget-area">',
'after' => '</div>',
'before_title' => '<h2 class="widget-title widgettitle">',
'before_after' => '</h2>',
) );
genesis_widget_area( 'front-page-grid', array(
'before' => '<div class="front-page-grid widget-area">',
'after' => '</div>',
'before_title' => '<h2 class="widget-title widgettitle">',
'before_after' => '</h2>',
) );
genesis_widget_area( 'front-page-cta', array(
'before' => '<div class="front-page-cta image-section widget-area">',
'after' => '</div>',
'before_title' => '<h2 class="widget-title widgettitle">',
'before_after' => '</h2>',
) );
genesis_widget_area( 'front-page-block-1', array(
'before' => '<div class="front-page-block-1 image-section widget-area"><div class="wrap">',
'after' => '</div></div>',
'before_title' => '<h2 class="widget-title widgettitle">',
'before_after' => '</h2>',
) );
genesis_widget_area( 'front-page-testimonials', array(
'before' => '<div class="front-page-testimonials image-section widget-area">',
'after' => '</div>',
'before_title' => '<h2 class="widget-title widgettitle">',
'before_after' => '</h2>',
) );
genesis_widget_area( 'front-page-blog', array(
'before' => '<div class="front-page-blog widget-area"><div class="wrap">',
'after' => '</div></div>',
'before_title' => '<h2 class="widget-title widgettitle">',
'before_after' => '</h2>',
) );
genesis_widget_area( 'front-page-block-2', array(
'before' => '<div class="front-page-block-2 image-section widget-area">',
'after' => '</div>',
'before_title' => '<h2 class="widget-title widgettitle">',
'before_after' => '</h2>',
) );
}
/**
* Add markup
*/
function digital_nomad_before_header() {
echo '<div class="custom-header-background open">';
}
/**
* Add markup
*/
function digital_nomad_home_hero() {
}
/**
* Add markup
*/
function digital_nomad_after_header() {
echo '</div>';
}
genesis();