![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/www/wp-content/themes/dt-the7/inc/mods/remove-customizer/ |
<?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;