forked from elementor/hello-theme-child
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
184 lines (163 loc) · 6.03 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
172
173
174
175
176
177
178
179
180
181
182
183
184
<?php
/**
* Theme functions and definitions
*
* @package HelloElementorChild
*/
/**
* Load child theme css and optional scripts
*
* @return void
*/
function hello_elementor_child_enqueue_scripts() {
wp_enqueue_style(
'hello-elementor-child-style',
get_stylesheet_directory_uri() . '/style.css',
[
'hello-elementor-theme-style',
],
'1.0.0'
);
}
add_action( 'wp_enqueue_scripts', 'hello_elementor_child_enqueue_scripts', 20 );
//*** Digitizer Scripts ***
//====================
// More Tips: https://elementor.com/help/hello-theme-tips/
// Disable plugin auto-update email notification
add_filter('auto_plugin_update_send_email', '__return_false');
// Disable theme auto-update email notification
add_filter('auto_theme_update_send_email', '__return_false');
// Disable WordPress core auto-update email notification
add_filter( 'auto_core_update_send_email', 'wpb_stop_auto_update_emails', 10, 4 );
function wpb_stop_update_emails( $send, $type, $core_update, $result ) {
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
return true;
}
// // HTTP Security Headers
// header('X-Frame-Options: SAMEORIGIN');
// header('X-XSS-Protection: 1; mode=block');
// header('X-Content-Type-Options: nosniff');
// header('Strict-Transport-Security:max-age=31536000; includeSubdomains; preload');
// @ini_set('session.cookie_httponly', true);
// @ini_set('session.cookie_secure', true);
// @ini_set('session.use_only_cookies', true);
// // Reorder Multiple Columns in Elementor
// function ben_add_responsive_column_order( $element, $args ) {
// $element->add_responsive_control(
// 'responsive_column_order',
// [
// 'label' => __( 'Responsive Column Order', 'ben-elementor-extras' ),
// 'type' => \Elementor\Controls_Manager::NUMBER,
// 'separator' => 'before',
// 'selectors' => [
// '{{WRAPPER}}' => '-webkit-order: {{VALUE}}; -ms-flex-order: {{VALUE}}; order: {{VALUE}};',
// ],
// ]
// );
// }
// add_action( 'elementor/element/column/layout/before_section_end', 'ben_add_responsive_column_order', 10, 2 );
// // disable gutenberg for posts
// add_filter('use_block_editor_for_post', '__return_false', 10);
// // disable gutenberg for post types
// add_filter('use_block_editor_for_post_type', '__return_false', 10);
// /***** VCF Support *****/
// function _enable_vcard_upload( $mime_types ){
// $mime_types['vcf'] = 'text/vcard';
// $mime_types['vcard'] = 'text/vcard';
// return $mime_types;
// }
// add_filter('upload_mimes', '_enable_vcard_upload' );
// /***** Shorten Post/Page link *****/
// add_filter( 'get_shortlink', function ( $shortlink ) {
// return $shortlink;
// });
// /***** Allow SVG *****/
// add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
// global $wp_version;
// if ( $wp_version !== '4.7.1' ) {
// return $data;
// }
// $filetype = wp_check_filetype( $filename, $mimes );
// return [
// 'ext' => $filetype['ext'],
// 'type' => $filetype['type'],
// 'proper_filename' => $data['proper_filename']
// ];
// }, 10, 4 );
// function cc_mime_types( $mimes ){
// $mimes['svg'] = 'image/svg+xml';
// return $mimes;
// }
// add_filter( 'upload_mimes', 'cc_mime_types' );
// function fix_svg() {
// echo '<style type="text/css">
// .attachment-266x266, .thumbnail img {
// width: 100% !important;
// height: auto !important;
// }
// </style>';
// }
// add_action( 'admin_head', 'fix_svg' );
// // Elementor Form Telephone Number Validition
// add_action( 'elementor_pro/forms/validation/tel', function( $field, $record, $ajax_handler ) {
// // Match this format XXXXXXXXXX, 1234567890
// if ( preg_match( '/[0-9]{10}/', $field['value'] ) !== 1 ) {
// $ajax_handler->add_error( $field['id'], 'הזן טלפון חוקי ללא מקף או רווח' );
// }
// }, 10, 3 );
// //******--- Remove Google Fonts ---******
// add_filter( 'elementor/frontend/print_google_fonts', '__return_false' );
/* //******--- Preconnect Google Fonts ---******
// function digitizer_preconnect() { ?>
// <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
// <?php
// }
// add_action('wp_head', 'digitizer_preconnect', 0);
*/
// //******--- Remove Font Awesome ---*****
// add_action( 'elementor/frontend/after_register_styles',function() {
// foreach( [ 'solid', 'regular', 'brands' ] as $style ) {
// wp_deregister_style( 'elementor-icons-fa-' . $style );
// }
// }, 20 );
// //*****--- Remove Eicons: ---*****
// add_action( 'wp_enqueue_scripts', 'remove_default_stylesheet', 20 );
// function remove_default_stylesheet() {
// wp_deregister_style( 'elementor-icons' );
// }
// //*****--- Remove Gutenberg Block Library CSS from loading on the frontend ---*****
// function smartwp_remove_wp_block_library_css(){
// wp_dequeue_style( 'wp-block-library' );
// wp_dequeue_style( 'wp-block-library-theme' );
// }
// add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css' );
// // remove wp version number from scripts and styles
// function remove_css_js_version( $src ) {
// if( strpos( $src, '?ver=' ) )
// $src = remove_query_arg( 'ver', $src );
// return $src;
// }
// add_filter( 'style_loader_src', 'remove_css_js_version', 9999 );
// add_filter( 'script_loader_src', 'remove_css_js_version', 9999 );
// // remove wp version number from head and rss
// function artisansweb_remove_version() {
// return '';
// }
// add_filter('the_generator', 'artisansweb_remove_version');
// // Upload webP images in WordPress
// function webp_upload_mimes( $existing_mimes ) {
// // add webp to the list of mime types
// $existing_mimes['webp'] = 'image/webp';
// // return the array back to the function with our added mime type
// return $existing_mimes;
// }
// add_filter( 'mime_types', 'webp_upload_mimes' );
// // Hide comments "URL" field
// add_filter('comment_form_default_fields', 'unset_url_field');
// function unset_url_field($fields){
// if(isset($fields['url']))
// unset($fields['url']);
// return $fields;
// }