-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
238 lines (163 loc) · 5.07 KB
/
Copy pathfunctions.php
File metadata and controls
238 lines (163 loc) · 5.07 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
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<?php
/**
* @package JFW
* @subpackage Blank
* @since JFW Blank ! 1.0
*/
/*
*
* JFW - 2016-12-21
* Julien Félix Web Themes plugins
*
*/
// include 'jfw_plugins/jfw_blazy_support/jfw_blazy_support.php';
// include 'jfw_plugins/jfw_swiper_support/jfw_swiper_support.php';
if ( ! function_exists( 'jfw_blank_setup' ) )
{
function jfw_blank_setup()
{
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
register_nav_menus( array( 'primary' => __( 'Primary Menu', 'jfw_blank' ) ) );
}
}
add_action( 'after_setup_theme', 'jfw_blank_setup' );
function jfw_blank_scripts()
{
// !JFW — 2019-12-12 — Prevent CSS Caching
wp_enqueue_style( 'jfw-blank-style', get_stylesheet_uri(), array(), md5(filemtime(dirname(__FILE__) . "/style.css")) );
// !JFW — 2019-12-12 — Prevent JS Caching
wp_enqueue_script( 'jfw-blank-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), md5(filemtime(dirname(__FILE__) . '/js/functions.js')), true );
}
add_action( 'wp_enqueue_scripts', 'jfw_blank_scripts' );
/*
*
* JFW - 2015-07-30
* Remove Emoji Support
*
*/
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
/*
*
* JFW - 2015-12-15
* Remove Tags Support
*
*/
function myprefix_unregister_tags()
{
unregister_taxonomy_for_object_type( 'post_tag', 'post' );
}
add_action( 'init', 'myprefix_unregister_tags' );
/*
*
* JFW - 2015-09-28
* Remove from Dashboard Widgets
*
*/
function remove_dashboard_widgets()
{
remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); // Right Now
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); // Recent Comments
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); // Incoming Links
remove_meta_box('dashboard_plugins', 'dashboard', 'normal'); // Plugins
remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); // Quick Press
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side'); // Recent Drafts
remove_meta_box('dashboard_primary', 'dashboard', 'side'); // WordPress blog
remove_meta_box('dashboard_secondary', 'dashboard', 'side'); // Other WordPress News
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal'); // activity panel
remove_action('welcome_panel', 'wp_welcome_panel'); // welcome panel
// use 'dashboard-network' as the second parameter to remove widgets from a network dashboard.
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
/*
*
* JFW - 2015-09-28
* Remove WP Customize Tools
*
*/
function remove_customize()
{
$customize_url_arr = array();
$customize_url_arr[] = 'customize.php'; // 3.x
$customize_url = add_query_arg( 'return', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'customize.php' );
$customize_url_arr[] = $customize_url; // 4.0 & 4.1
if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize') )
{
$customize_url_arr[] = add_query_arg( 'autofocus[control]', 'header_image', $customize_url ); // 4.1
$customize_url_arr[] = 'custom-header'; // 4.0
}
if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize') )
{
$customize_url_arr[] = add_query_arg( 'autofocus[control]', 'background_image', $customize_url ); // 4.1
$customize_url_arr[] = 'custom-background'; // 4.0
}
foreach ( $customize_url_arr as $customize_url ) {
remove_submenu_page( 'themes.php', $customize_url );
}
}
add_action( 'admin_menu', 'remove_customize', 999 );
/*
*
* JFW - 2015-07-30
* Remove from Backend Adminbar
*
*/
function remove_admin_bar_links() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wp-logo');
$wp_admin_bar->remove_menu('about');
$wp_admin_bar->remove_menu('wporg');
$wp_admin_bar->remove_menu('documentation');
$wp_admin_bar->remove_menu('support-forums');
$wp_admin_bar->remove_menu('feedback');
$wp_admin_bar->remove_menu('comments');
$wp_admin_bar->remove_menu('w3tc');
$wp_admin_bar->remove_menu('customize');
}
add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_links' );
/*
*
* JFW - 2015-08-16
* Shortcode to project emails
* [email mail="mail@domain.com"]Email[/email]
*
*/
function wpcodex_hide_email_shortcode( $atts , $content = null )
{
$a = shortcode_atts( array( 'mail' => 'null' ), $atts );
if ( ! is_email( $a['mail'] ) ) {
return;
}
if ( $a['mail'] == 'null' ) {
return;
}
if ( $content == 'null' ) {
return;
}
$pretty_content;
if( is_email( $content ) ) {
$pretty_content = antispambot( $content );
}else{
$pretty_content = $content;
}
return '<a href="mailto:' . antispambot( $a['mail'] ) . '">' . $pretty_content . '</a>';
}
add_shortcode( 'email', 'wpcodex_hide_email_shortcode' );
// !JFW - Remove from Backend Sidebar
function remove_menus ()
{
global $menu;
$restricted = array(
__('Comments')
);
end( $menu );
while( prev( $menu ) )
{
$value = explode( ' ', $menu[ key( $menu ) ][0] );
if( in_array( $value[0] != NULL?$value[0]:"" , $restricted ) ) {
unset( $menu[ key( $menu ) ] );
}
}
}
add_action('admin_menu', 'remove_menus');