-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
91 lines (80 loc) · 2.04 KB
/
functions.php
File metadata and controls
91 lines (80 loc) · 2.04 KB
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
<?php
/**
* Additional functionality for the theme.
*
* Before adding check if it should be a plugin.
*/
// disallow file edit in admin
add_action( 'init', function() {
if ( ! defined( 'DISALLOW_FILE_EDIT' ) ) {
define( 'DISALLOW_FILE_EDIT', true );
}
});
if ( ! function_exists( 'tsv1913_editor_style' ) ) {
/**
* Enqueues editor-style.css in the editors.
*
* @since tsv1913 1.2
*/
function tsv1913_editor_style() {
add_editor_style( get_parent_theme_file_uri( 'assets/css/editor-style.css' ) );
}
}
add_action( 'after_setup_theme', 'tsv1913_editor_style' );
if ( ! function_exists( 'tsv1913_enqueue_styles' ) ) {
/**
* Enqueues style.css on the front.
*
* @since tsv1913 1.0
*/
function tsv1913_enqueue_styles() {
wp_enqueue_style(
'tsv1913-style',
get_parent_theme_file_uri( 'style.css' ),
array(),
wp_get_theme()->get( 'Version' )
);
}
}
add_action( 'wp_enqueue_scripts', 'tsv1913_enqueue_styles' );
if ( ! function_exists( 'tsv1913_add_default_avatar_option' ) ) {
/**
* Add own profile image avatar option.
*
* @since tsv1913 1.1
*/
function tsv1913_add_default_avatar_option( $avatars ) {
$url = get_parent_theme_file_uri() . '/assets/images/avatar-default.png';
$avatars[ $url ] = 'TSV Avatar';
return $avatars;
}
}
add_filter( 'avatar_defaults', 'tsv1913_add_default_avatar_option' );
if ( ! function_exists( 'tsv1913_fix_default_avatar_url' ) ) {
/**
* Fix theme default avatar url since it gets some gravatar prefix.
*
* @since tsv1913 1.1
*
* @return void
*/
function tsv1913_fix_default_avatar_url( $args ) {
if ( $args['found_avatar'] === false ) {
$args['url'] = $args['default'];
}
return $args;
}
}
add_filter( 'get_avatar_data', 'tsv1913_fix_default_avatar_url');
/**
* Change form block recipients.
*
* @since tsv1913 1.4
*
* @return array
*/
function tsv1913_form_block_recipients( array $recipients ): array {
$recipients = [ 'kontakt@tsv1913.de' ];
return $recipients;
}
add_filter( 'form_block_recipients', 'tsv1913_form_block_recipients', 10, 1 );