This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
functions.php
132 lines (118 loc) · 5.13 KB
/
functions.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
function child_theme_enqueue_styles() {
$parent_style = 'twentyseventeen-style';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'child_theme_enqueue_styles' );
// // Filter the except length to 20 words.
function custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
// Remove ReadMore link from index
function child_theme_setup() {
remove_filter( 'excerpt_more', 'twentyseventeen_excerpt_more' );
}
add_action( 'after_setup_theme', 'child_theme_setup' );
if ( ! function_exists( 'twentyseventeen_posted_on' ) ) :
/**
* Integrate Co-Authors Plus with TwentySeventeen by replacing twentyseventeen_posted_on() with this function
*/
function twentyseventeen_posted_on() {
$postName = get_post_field( 'post_name', get_post() );
$pubDate = get_the_date();
$modDate = get_the_modified_date();
$gitDate = get_the_date('Y-m-d');
$gitLink = 'https://github.com/zcash/zcash-blog/blob/master/_posts/' . $gitDate . '-' . $postName . '.md';
if ($modDate > $pubDate) {
$postDates = '<span class="entry-date"><span class="pub-date">'.$pubDate.'</span> • <span class="update-date">Updated: '.$modDate.'</span></span>';
} else {
$postDates = '<span class="entry-date">'.$pubDate.'</span>';
}
if ( function_exists( 'coauthors_posts_links' ) ) :
printf( __( '%3$s <span class="meta-sep">|</span> %2$s', 'twentyseventeen' ),
'meta-prep meta-prep-author',
sprintf( '<a href="'.$gitLink.'" title="%2$s" rel="bookmark" class="posted-on">%3$s</a>',
get_permalink(),
esc_attr( get_the_time() ),
$postDates
),
coauthors_posts_links( null, null, null, null, false )
);
else:
printf( __( '%3$s <span class="meta-sep">|</span> %2$s', 'twentyseventeen' ),
'meta-prep meta-prep-author',
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark" class="posted-on"><span class="entry-date">%3$s</span></a>',
get_permalink(),
esc_attr( get_the_time() ),
$postDates
),
sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
get_author_posts_url( get_the_author_meta( 'ID' ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'twentyseventeen' ), get_the_author() ) ),
get_the_author()
)
);
endif;
}
endif;
//enqueues our locally supplied font awesome stylesheet
function enqueue_zcash_stylesheets(){
wp_enqueue_style('font-open-sans', get_stylesheet_directory_uri() . '/css/font-open-sans.css');
wp_enqueue_style('font-awesome', get_stylesheet_directory_uri() . '/css/font-awesome.min.css');
}
add_action('wp_enqueue_scripts','enqueue_zcash_stylesheets');
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
function zcash_custom_header_setup() {
add_theme_support( 'custom-header', array(
'default-image' => '',
'default-text-color' => 'FFFFFF',
'width' => 190,
'height' => 84,
'flex-width' => true,
'flex-height' => true,
) );
}
add_action( 'after_setup_theme', 'zcash_custom_header_setup' );
remove_action( 'wp_head', 'feed_links', 2 );
add_action('wp_head', 'addBackPostFeed');
function addBackPostFeed() {
echo '<link rel="alternate" type="application/rss+xml" title="RSS 2.0 Feed" href="'.get_bloginfo('rss2_url').'" />';
}
/**
* Auto-subscribe or unsubscribe an Edit Flow user group when a post changes status
* @see http://editflow.org/extend/auto-subscribe-user-groups-for-notifications/
*/
function efx_auto_subscribe_usergroup( $new_status, $old_status, $post ) {
global $edit_flow;
if ( ( 'pending' == $new_status ) || ( 'published' == $new_status ) ) {
$usergroup_ids_to_follow = array(
168
);
$edit_flow->notifications->follow_post_usergroups( $post->ID, $usergroup_ids_to_follow, true );
}
// Return true to send the email notification
return $new_status;
}
add_filter( 'ef_notification_status_change', 'efx_auto_subscribe_usergroup', 10, 3 );
add_filter( 'wp_nav_menu_items', 'custom_menu_item', 10, 2 );
function custom_menu_item ( $items, $args ) {
if ($args->theme_location == 'top') {
$items = '<li class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item"><a href="'.esc_url( home_url( '/' ) ).'">Home</a></li> ' . $items;
$items .= '<li class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-search-box">' . get_search_form( false ) . '</li>';
return $items;
}
return $items;
}
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
?>