| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.9/wp-content/themes/dt-the7/inc/mods/remove-customizer/ |
Upload File : |
<?php
/**
* "Remove Customizer" Module
* Inspired by https://wordpress.org/plugins/customizer-remove-all-parts
*
* @package The7
*/
defined( 'ABSPATH' ) || exit;
if ( ! class_exists( 'Presscore_Modules_Remove_Customizer_Module', false ) ) :
class Presscore_Modules_Remove_Customizer_Module {
/**
* Execute module.
*/
public static function execute() {
add_action( 'load-themes.php', array( __CLASS__, 'add_load_themes_hooks' ) );
add_action( 'wp_before_admin_bar_render', array(
__CLASS__,
'remove_wp_customize_support_script_from_admin_bar'
), 9 );
}
/**
* Add hooks for themes.php admin page.
*/
public static function add_load_themes_hooks() {
add_action( 'admin_enqueue_scripts', array( __CLASS__, 'hide_customizer_buttons' ) );
}
/**
* Add inline css to hide Customizer buttons for active The7 theme.
*/
public static function hide_customizer_buttons() {
// Do not hide Customizer for a child themes.
if ( is_child_theme() ) {
return;
}
wp_add_inline_style( 'the7-admin', '
/** Hide Customizer button on themes.php page for active dt-the7 theme **/
.theme.active > .theme-id-container > .theme-actions {
box-shadow: none;
background: none
}
.theme.active .hide-if-no-customize,
.theme-overlay.active .active-theme .hide-if-no-customize {
display: none;
}
' );
}
/**
* Hide customizer in admin bar.
*
* @see wp_customize_support_script
*/
public static function remove_wp_customize_support_script_from_admin_bar() {
remove_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
}
}
Presscore_Modules_Remove_Customizer_Module::execute();
endif;