-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbip-pages-styling.php
36 lines (30 loc) · 1.02 KB
/
bip-pages-styling.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
<?php
namespace BipPages;
function add_title_container( $title, $id = null ) {
$post = get_post( $id );
if ( is_singular( 'bip' ) || ( is_search() && $post->post_type == 'bip' ) ) {
$title = "<span class='bip-title-container'>" . $title . "</span>";
}
return $title;
}
add_filter( 'the_title', __NAMESPACE__ . '\add_title_container', 10, 2 );
function add_post_class( $classes, $class = '', $post_id = '' ) {
$post = get_post();
if ( $post->post_type == 'bip' ) {
$classes[] = 'type-page';
}
return $classes;
}
add_filter( 'post_class', __NAMESPACE__ . '\add_post_class' );
function mark_bip_page_states( $post_states, $post ) {
switch ( $post->ID ) {
case get_bip_main_page():
$post_states[] = esc_html__( 'BIP Main Page', 'bip-pages' );
break;
case get_bip_instruction_page():
$post_states[] = esc_html__( 'BIP Instruction Page', 'bip-pages' );
break;
}
return $post_states;
}
add_filter( 'display_post_states', __NAMESPACE__ . '\mark_bip_page_states', 10, 2 );