-
Notifications
You must be signed in to change notification settings - Fork 2
/
functions.php
executable file
·127 lines (78 loc) · 2.36 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
<?php /*
===============================================================
CommentPress Nav Below Functions
===============================================================
AUTHOR: Christian Wach <[email protected]>
---------------------------------------------------------------
NOTES
Example theme amendments and overrides.
---------------------------------------------------------------
*/
/**
* Set the content width based on the theme's design and stylesheet.
* This seems to be a Wordpress requirement - though rather dumb in the
* context of our theme, which has a percentage-based default width.
* I have arbitrarily set it to the apparent content-width when viewing
* on a 1280px-wide screen.
*/
if ( !isset( $content_width ) ) { $content_width = 586; }
/**
* @description: augment the CommentPress Default Theme setup function
* @todo:
*
*/
function cpnavbelow_setup(
) { //-->
/**
* Make theme available for translation.
* Translations can be added to the /languages/ directory of the child theme.
*/
load_theme_textdomain(
'commentpress-nav-below',
get_stylesheet_directory() . '/languages'
);
}
// add after theme setup hook
add_action( 'after_setup_theme', 'cpnavbelow_setup' );
/**
* @description: override styles by enqueueing as late as we can
* @todo:
*
*/
function cpnavbelow_enqueue_styles() {
// init
$dev = '';
// check for dev
if ( defined( 'SCRIPT_DEBUG' ) AND SCRIPT_DEBUG === true ) {
$dev = '.dev';
}
// add child theme's css file
wp_enqueue_style(
'cpnavbelow_css',
get_stylesheet_directory_uri() . '/assets/css/style-overrides'.$dev.'.css',
array( 'cp_reset_css' ),
'1.0', // version
'all' // media
);
// add child theme's js file
wp_enqueue_script(
'cpnavbelow_js',
get_stylesheet_directory_uri() . '/assets/js/script-overrides.js',
array( 'cp_common_js' )
);
}
// add a filter for the above
add_filter( 'wp_enqueue_scripts', 'cpnavbelow_enqueue_styles', 110 );
/**
* @description: override default setting for comment registration
* @todo:
*
*/
function cpnavbelow_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', 'cpnavbelow_sidebar_tab_order', 21, 1 );