1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Custom functions that act independently of the theme templates |
4
|
|
|
* |
5
|
|
|
* Eventually, some of the functionality here could be replaced by core features. |
6
|
|
|
* |
7
|
|
|
* @package WordPress |
8
|
|
|
* @subpackage Strip |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Adds custom classes to the array of body classes. |
13
|
|
|
* |
14
|
|
|
* @param $strings $classes group-blog. |
|
|
|
|
15
|
|
|
*/ |
16
|
|
|
function strip_body_classes( $classes ) { |
|
|
|
|
17
|
|
|
// Adds a class of group-blog to blogs with more than 1 published author. |
18
|
|
|
if ( is_multi_author() ) { |
19
|
|
|
$classes[] = 'group-blog'; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
return $classes; |
23
|
|
|
} |
24
|
|
|
add_filter( 'body_class', 'strip_body_classes' ); |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Disable the emoji's |
28
|
|
|
*/ |
29
|
|
|
function disable_emojis() { |
30
|
|
|
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); |
31
|
|
|
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); |
32
|
|
|
remove_action( 'wp_print_styles', 'print_emoji_styles' ); |
33
|
|
|
remove_action( 'admin_print_styles', 'print_emoji_styles' ); |
34
|
|
|
remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); |
35
|
|
|
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); |
36
|
|
|
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); |
37
|
|
|
add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' ); |
38
|
|
|
add_filter( 'wp_resource_hints', 'disable_emojis_remove_dns_prefetch', 10, 2 ); |
39
|
|
|
} add_action( 'init', 'disable_emojis' ); |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Filter function used to remove the tinymce emoji plugin introduced in WordPress 4.2. |
43
|
|
|
* |
44
|
|
|
* @param array $plugins disable_emojis_tinymce. |
45
|
|
|
* @return array Difference betwen the two arrays. |
46
|
|
|
*/ |
47
|
|
|
function disable_emojis_tinymce( $plugins ) { |
48
|
|
|
if ( is_array( $plugins ) ) { |
49
|
|
|
return array_diff( $plugins, array( 'wpemoji' ) ); |
50
|
|
|
} return array(); |
51
|
|
|
} |
52
|
|
|
/** |
53
|
|
|
* Remove emoji CDN hostname from DNS prefetching hints. |
54
|
|
|
*/ |
55
|
|
|
|
56
|
|
|
add_filter( 'emoji_svg_url', '__return_false' ); |
57
|
|
|
|
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.