-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfront-page.php
executable file
·110 lines (79 loc) · 3.26 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
<?php
//* Enqueue scripts
add_action( 'wp_enqueue_scripts', 'minimum_front_page_enqueue_scripts' );
function minimum_front_page_enqueue_scripts() {
//* Load scripts only if custom background is being used
if ( ! get_background_image() )
return;
//* Enqueue Backstretch scripts
wp_enqueue_script( 'minimum-backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/backstretch.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_script( 'minimum-backstretch-set', get_bloginfo('stylesheet_directory').'/js/backstretch-set.js' , array( 'jquery', 'minimum-backstretch' ), '1.0.0' );
wp_localize_script( 'minimum-backstretch-set', 'BackStretchImg', array( 'src' => str_replace( 'http:', '', get_background_image() ) ) );
//* Add custom body class
add_filter( 'body_class', 'minimum_add_body_class' );
}
//* Minimum custom body class
function minimum_add_body_class( $classes ) {
$classes[] = 'minimum';
return $classes;
}
//* Add widget support for homepage if widgets are being used
add_action( 'genesis_meta', 'minimum_front_page_genesis_meta' );
function minimum_front_page_genesis_meta() {
if ( is_home() ) {
//* Remove entry meta in entry footer and Genesis loop
// remove_action( 'genesis_loop', 'genesis_do_loop' );
//* Add Genesis grid loop
add_action( 'genesis_loop', 'minimum_grid_loop_helper' );
//* Remove entry footer functions
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
//* Force full width content layout
// add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
}
if ( is_active_sidebar( 'home-featured-1' ) || is_active_sidebar( 'home-featured-2' ) || is_active_sidebar( 'home-featured-3' ) || is_active_sidebar( 'home-featured-4' ) ) {
//* Add Home featured Widget areas
add_action( 'genesis_before_content_sidebar_wrap', 'minimum_home_featured', 15 );
}
}
//* Add markup for homepage widgets
function minimum_home_featured() {
printf( '<div %s>', genesis_attr( 'home-featured' ) );
genesis_structural_wrap( 'home-featured' );
genesis_widget_area( 'home-featured-1', array(
'before' => '<div class="home-featured-1 widget-area">',
'after' => '</div>',
) );
genesis_widget_area( 'home-featured-2', array(
'before' => '<div class="home-featured-2 widget-area">',
'after' => '</div>',
) );
genesis_widget_area( 'home-featured-3', array(
'before' => '<div class="home-featured-3 widget-area">',
'after' => '</div>',
) );
genesis_widget_area( 'home-featured-4', array(
'before' => '<div class="home-featured-4 widget-area">',
'after' => '</div>',
) );
genesis_structural_wrap( 'home-featured', 'close' );
echo '</div>'; //* end .home-featured
}
//* Genesis grid loop
function minimum_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 0,
'feature_image_size' => 0,
'feature_content_limit' => 0,
'grid_image_size' => 0,
'grid_content_limit' => 250,
'more' => __( '[Read more]', 'minimum' ),
) );
} else {
genesis_standard_loop();
}
}
//* Run the Genesis loop
genesis();