-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfront-page.php
92 lines (65 loc) · 2.9 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
<?php
/**
* This file adds the Home Page to the Genesis BW Theme.
*
* @author bobbingwide
* @package Genesis BW
* @subpackage Customizations
*/
//* Filter the homepage site description
add_filter( 'genesis_seo_description', 'genesis_bw_seo_description', 10, 2 );
function genesis_bw_seo_description( $description, $inside ) {
$inside = esc_html( get_bloginfo( 'description' ) );
$description = sprintf( '<h2 class="site-description">%s</h2>', $inside );
return $description;
}
add_action( 'genesis_meta', 'genesis_bw_front_page_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function genesis_bw_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' ) ) {
//* Add front-page body class
add_filter( 'body_class', 'genesis_bw_body_class' );
function genesis_bw_body_class( $classes ) {
$classes[] = 'front-page';
return $classes;
}
//* 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' );
//* Add the rest of front page widgets
add_action( 'genesis_loop', 'genesis_bw_front_page_widgets' );
}
}
function genesis_bw_front_page_widgets() {
$image_section_1 = get_option( '1-genesis_bw-image', sprintf( '%s/images/bg-1.jpg', get_stylesheet_directory_uri() ) );
$image_section_2 = get_option( '2-genesis_bw-image', sprintf( '%s/images/bg-2.jpg', get_stylesheet_directory_uri() ) );
if ( ! empty( $image_section_1 ) ) {
echo '<div class="image-section-1"></div>';
}
genesis_widget_area( 'front-page-1', array(
'before' => '<div id="front-page-1" class="front-page-1"><div class="flexible-widgets widget-area wrap' . genesis_bw_widget_area_class( 'front-page-1' ) . '">',
'after' => '</div></div>',
) );
genesis_widget_area( 'front-page-2', array(
'before' => '<div id="front-page-2" class="front-page-2"><div class="flexible-widgets widget-area wrap' . genesis_bw_widget_area_class( 'front-page-2' ) . '">',
'after' => '</div></div>',
) );
genesis_widget_area( 'front-page-3', array(
'before' => '<div id="front-page-3" class="front-page-3"><div class="flexible-widgets widget-area wrap' . genesis_bw_widget_area_class( 'front-page-3' ) . '">',
'after' => '</div></div>',
) );
if ( ! empty( $image_section_2 ) ) {
echo '<div class="image-section-2"></div>';
}
genesis_widget_area( 'front-page-4', array(
'before' => '<div id="front-page-4" class="front-page-4"><div class="flexible-widgets widget-area wrap' . genesis_bw_widget_area_class( 'front-page-4' ) . '">',
'after' => '</div></div>',
) );
}
genesis();