-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.php
107 lines (89 loc) · 2.29 KB
/
home.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
<?php
/**
* Home
*
* PHP version 5
*
* @package PicturePerfect
* @author Agent Evolution <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
* @link http://themes.agentevolution.com
*/
add_action('genesis_meta', 'picture_perfect_home_genesis_meta');
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
* @return void
*/
function picture_perfect_home_genesis_meta()
{
$sidebar_widget_areas = array(
'home-right',
);
if (false === any_picture_perfect_sidebar_is_active($sidebar_widget_areas)) {
add_filter('body_class', 'picture_perfect_blog_home_page_body_class');
return;
}
add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content');
remove_action('genesis_after_content', 'genesis_footer_widget_areas', 999);
# Custom body class
add_filter('body_class', 'picture_perfect_custom_home_page_body_class');
# Remove the loop and add a custom loop
remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'picture_perfect_home_loop_helper');
}
/**
* Adds a custom body class on the home page
*
* @param array $classes the current body classes
*
* @return array modified classes
*/
function picture_perfect_blog_home_page_body_class($classes)
{
$classes[] = 'blog-home-page';
return $classes;
}
/**
* Adds a custom body class on the home page
*
* @param array $classes the current body classes
*
* @return array modified classes
*/
function picture_perfect_custom_home_page_body_class($classes)
{
$classes[] = 'custom-home-page';
return $classes;
}
/**
* Display widget content for homepage sections
*
* @return void
*/
function picture_perfect_home_loop_helper()
{
echo '<div class="home-right">';
picture_perfect_site_title_description_markup();
if (is_active_sidebar('home-right')) {
dynamic_sidebar('home-right');
}
echo '</div>';
}
/**
* Returns true if any of the picture_perfect sidebars are active
*
* @param array $sidebar_widget_areas registered sidebars for use on home page
*
* @return bool
*/
function any_picture_perfect_sidebar_is_active($sidebar_widget_areas)
{
foreach($sidebar_widget_areas as $sidebar) {
if ( is_active_sidebar($sidebar) ) {
return true;
}
}
return false;
}
genesis();