This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfunctions.php
executable file
·171 lines (104 loc) · 3.33 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php /*
===============================================================
Commentpress Child Theme Functions
===============================================================
AUTHOR : Christian Wach <[email protected]>
LAST MODIFIED : 31/08/2012
---------------------------------------------------------------
NOTES
Example theme amendments and overrides.
---------------------------------------------------------------
*/
/**
* @description: add to the Commentpress setup function 'cp_setup'
* @todo:
*
*/
function cpchild_setup(
) { //-->
/**
* Make theme available for translation.
* Translations can be added to the /languages/ directory of the child theme.
* If you're building a theme based on this as a "starter pack", use a find and replace
* to change 'commentpress-child-theme' to the name of your theme in all the template files.
*/
load_theme_textdomain(
'commentpress-child-theme',
get_stylesheet_directory() . '/languages'
);
// This theme styles the visual editor with editor-style.css to match the theme style.
add_editor_style();
}
// add after theme setup hook
add_action( 'after_setup_theme', 'cpchild_setup' );
/**
* @description: override default setting for comment registration
* @todo:
*
*/
function cpchild_sidebar_tab_order( $order ) {
// ignore what's sent to us and set our own order here
$cpuea_order = array( 'contents', 'activity', 'comments' );
// --<
return $cpuea_order;
}
// add a filter for the above
add_filter( 'cp_sidebar_tab_order', 'cpchild_sidebar_tab_order', 21, 1 );
/**
* @description: override the title of the "Recent Comments in..." link
* @todo:
*
*/
function cpchild_activity_tab_recent_title_blog( $title ) {
// if groupblog...
global $commentpress_obj;
if (
!is_null( $commentpress_obj )
AND is_object( $commentpress_obj )
AND $commentpress_obj->is_groupblog()
) {
// override default link name for a Group Blog context
return __( 'Recent Comments in this Blog', 'commentpress-child-theme' );
}
// if main site...
if ( is_multisite() AND is_main_site() ) {
// override default link name for the main site of a Multisite context
return __( 'Recent Comments on Main Site', 'commentpress-child-theme' );
} else {
// override default link name for a Single Install context
return __( 'Recent Comments on this Site', 'commentpress-child-theme' );
}
// --<
return $title;
}
// add a filter for the above
add_filter( 'cp_activity_tab_recent_title_blog', 'cpchild_activity_tab_recent_title_blog', 21, 1 );
/**
* @description: override styles by enqueueing as late as we can
* @todo:
*
*/
function cpchild_enqueue_styles() {
// init
$dev = '';
// check for dev
if ( defined( 'SCRIPT_DEBUG' ) AND SCRIPT_DEBUG === true ) {
$dev = '.dev';
}
// add Commentpress Theme css file
//wp_enqueue_style( 'cpchild_parent_css', get_template_directory_uri() . '/style.css' );
// add child theme's css file
wp_enqueue_style(
'cpchild_css',
get_stylesheet_directory_uri() . '/assets/css/style-overrides'.$dev.'.css'
);
// add child theme's js file
wp_enqueue_script(
'cpchild_js',
get_stylesheet_directory_uri() . '/assets/js/script-overrides.js',
array( 'cp_common' )
);
}
// add a filter for the above
add_filter( 'wp_enqueue_scripts', 'cpchild_enqueue_styles', 50 );
?>