99
1010require get_stylesheet_directory () . '/includes/utils.php ' ;
1111require get_stylesheet_directory () . '/includes/settings.php ' ;
12+ require get_stylesheet_directory () . '/includes/overrides.php ' ;
13+
14+ define ('CHILD_THEME_URI ' , get_stylesheet_directory_uri ());
15+ define ('WHITE_LABEL ' , true );
16+
17+ function nordcom_load_theme_textdomain () {
18+ load_theme_textdomain ('betheme-wordpress-headless-theme ' , get_stylesheet_directory () .'/languages ' );
19+ }
20+ add_action ('after_setup_theme ' , 'nordcom_load_theme_textdomain ' );
21+
22+
23+ if (get_theme_mod ("headless_embeded_enable " , true )) {
24+ if (!function_exists ('nordcom_theme_query_vars ' )) {
25+ function nordcom_theme_query_vars ($ vars ) {
26+ $ vars [] = "iframe " ;
27+ return $ vars ;
28+ }
29+ }
30+ add_filter ('query_vars ' , 'nordcom_theme_query_vars ' );
31+ get_query_var ('iframe ' );
32+ }
1233
1334if (!function_exists ('nordcom_theme_head ' )) {
1435 function nordcom_theme_head () {
@@ -31,13 +52,61 @@ function nordcom_theme_enqueue_styles() {
3152}
3253add_action ('wp_enqueue_scripts ' , 'nordcom_theme_enqueue_styles ' );
3354
34- if (get_theme_mod ("headless_embeded_enable " , true )) {
35- if (!function_exists ('nordcom_theme_query_vars ' )) {
36- function nordcom_theme_query_vars ($ vars ) {
37- $ vars [] = "iframe " ;
38- return $ vars ;
55+ if (!function_exists ('nordcom_disable_builtin ' )) {
56+ // Based on https://dykraf.com/blog/wordpress-set-up-for-different-home-url-and-site-url
57+ function nordcom_disable_builtin () {
58+ remove_action ('wp_head ' , 'rest_output_link_wp_head ' );
59+ remove_action ('wp_head ' , 'wp_resource_hints ' , 2 );
60+ remove_action ('wp_head ' , 'print_emoji_detection_script ' , 7 );
61+ remove_action ('wp_head ' , 'rsd_link ' );
62+ remove_action ('wp_head ' , 'wlwmanifest_link ' );
63+ remove_action ('admin_print_scripts ' , 'print_emoji_detection_script ' );
64+ remove_action ('wp_print_styles ' , 'print_emoji_styles ' );
65+ remove_action ('admin_print_styles ' , 'print_emoji_styles ' );
66+ remove_filter ('the_content_feed ' , 'wp_staticize_emoji ' );
67+ remove_filter ('comment_text_rss ' , 'wp_staticize_emoji ' );
68+ remove_filter ('wp_mail ' , 'wp_staticize_emoji_for_email ' );
69+ remove_action ('wp_head ' , 'wp_generator ' );
70+
71+ function nordcom_disable_emojis_tinymce ( $ plugins ) {
72+ if (is_array ($ plugins ))
73+ return array_diff ($ plugins , array ('wpemoji ' ));
74+
75+ return array ();
76+ }
77+ add_filter ('tiny_mce_plugins ' , 'nordcom_disable_emojis_tinymce ' );
78+
79+ function nordcom_disable_emojis_dns ( $ urls , $ relation_type ) {
80+ if ('dns-prefetch ' === $ relation_type ) {
81+ /** This filter is documented in wp-includes/formatting.php */
82+ $ emoji_svg_url = apply_filters ( 'emoji_svg_url ' , 'https://s.w.org/images/core/emoji/2/svg/ ' );
83+ $ urls = array_diff ( $ urls , array ( $ emoji_svg_url ) );
84+ }
85+
86+ return $ urls ;
3987 }
88+ add_filter ( 'wp_resource_hints ' , 'nordcom_disable_emojis_dns ' , 10 , 2 );
89+ }
90+ }
91+ add_action ('init ' , 'nordcom_disable_builtin ' );
92+
93+ if (!function_exists ('nordcom_dequeue_builtin ' )) {
94+ function nordcom_dequeue_builtin (){
95+ wp_dequeue_style ('wp-block-library ' );
96+ wp_dequeue_style ('wp-block-library-theme ' );
4097 }
41- add_filter ('query_vars ' , 'nordcom_theme_query_vars ' );
42- get_query_var ('iframe ' );
4398}
99+ add_action ('wp_enqueue_scripts ' , 'nordcom_dequeue_builtin ' );
100+
101+ function nordcom_disable_admin_menus () {
102+ if (is_admin ()){
103+ remove_menu_page ('edit.php?post_type=client ' );
104+ remove_menu_page ('edit.php?post_type=offer ' );
105+ remove_menu_page ('edit.php?post_type=slide ' );
106+ remove_menu_page ('edit.php?post_type=testimonial ' );
107+ remove_menu_page ('edit.php?post_type=layout ' );
108+ remove_menu_page ('edit.php?post_type=template ' );
109+ }
110+ }
111+
112+ add_action ('admin_menu ' , 'nordcom_disable_admin_menus ' , 999 );
0 commit comments