-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.php
71 lines (56 loc) · 1.67 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
<?php
/**
* Boss Pro
*
* This file edits the posts page template in the Boss Pro Theme.
*
* @package Boss
* @author Bloom
* @license GPL-2.0+
* @link http://my.studiopress.com/themes/boss/
*/
add_filter( 'body_class', 'boss_home_page_header_body_class' );
/**
* Add the with-page-header class.
*
* @param array $classes
* @return void
*
* @since 1.0.0
*/
function boss_home_page_header_body_class( $classes ) {
$posts_page_id = get_option( 'page_for_posts' );
if ( has_post_thumbnail( $posts_page_id ) ) {
$classes[] = 'with-page-header';
}
return $classes;
}
add_action( 'genesis_after_header', 'boss_home_page_header', 8 );
/**
* Add the Home Page Header.
*
* @return void
*
* @since 1.0.0
*/
function boss_home_page_header() {
$output = false;
$posts_page_id = get_option( 'page_for_posts' );
$image = get_post_thumbnail_id( $posts_page_id );
if ( $image ) {
// Remove the page title because we're going to add it later.
remove_action( 'genesis_before_loop', 'genesis_do_posts_page_heading' );
// Remove the default page header.
remove_action( 'genesis_after_header', 'boss_page_header', 8 );
$image = wp_get_attachment_image_src( $image, 'boss_hero' );
$background_image_class = 'with-background-image';
$title = get_the_title( $posts_page_id );
$output .= '<div class="page-header bg-primary with-background-image" style="background-image: url(' . $image[0] . ');"><div class="wrap">';
$output .= '<div class="header-content"><h1>' . $title . '</h1></div>';
$output .= '</div></div>';
}
if ( $output ) {
echo $output;
}
}
genesis();