Widgets (P.S. Also, review OTHER MUST-HAVE PLUGINS FOR EVERYONE. ) Version: 1.15 Text Domain: add-scripts-short-codes-in-footer Domain Path: /languages Author: TazoTodua Author URI: http://www.protectpages.com/profile Plugin URI: https://www.protectpages.com/web-coding-programming-software/our-wordpress-plugins/ Donate link: http://paypal.me/tazotodua License: GPL3 License URI: https://www.gnu.org/licenses/gpl-3.0.html */ namespace AddScriptAndCodesInFooter; if (!defined('ABSPATH')) exit; include_once(__DIR__.'/____defaults.php'); class MyClass{ use \my_default_methods_T_Todua; public function __construct_my(){ add_action('wp_head', array($this, 'my_header_func') ); add_action('wp_loaded', array($this, 'my_footer_deregister'), 99); add_action('widgets_init', array($this, 'my_widgets_init') ); //add_action('plugins_loaded', array($this, 'plugin_loaded_my'), 11); } public function declare_static_settings(){ //multisite, singlesite, both $this->static_settings=array('show_opts'=>true, 'required_role'=>'manage_options', 'managed_from'=>'multisite', 'allowed_on'=>'multisite'); $this->user_initial_options = array( 'remove_footer' => false, 'footer_id' => '' ); } // ============================================================================================================== // // ============================================================================================================== // public function my_widgets_init(){ $value= 'footer-addition-asacif'; register_sidebar( array('name' => 'WP Footer Addition' ,'id' => strtolower($value), 'before_widget'=>'
','after_widget'=>'
','before_title'=>'

','after_title'=>'

',) ); } public function my_footer_deregister(){ if($this->opts['remove_footer']){ remove_all_actions('wp_footer') ; //foreach( $GLOBALS['wp_filter']['wp_footer']->callbacks as $eachCallback){ } add_action('wp_footer', array($this, 'my_footer_func2'), 10); } public function my_footer_func2(){ if(is_active_sidebar('footer-addition-asacif')){ echo ''; if($this->opts['remove_footer'] && !empty($this->opts['footer_id']) ){ ?> .footer-asacif{ text-align:center; display:flex; justify-content:center; background: #e7e7e7; margin:20px 0px 0px; background:#969696; padding: 20px 0px 10px; } .footer-asacif *{ width:100%;} '; } public function opts_page_output(){ //if form updated if(isset($_POST["_wpnonce"]) && check_admin_referer("form1_nonce_".$this->plugin_slug) ) { $this->opts['remove_footer']= !empty($_POST[ $this->plugin_slug ]['remove_footer']) ; $this->opts['footer_id'] = trim($_POST[ $this->plugin_slug ]['footer_id']) ; $this->update_option_CHOSEN($this->plugin_slug, $this->opts); } ?> settings_page_part("start"); ?>

using JavaScript. (You can use this if the above first (in the top) solution cant remove some parts of footer. However, JavaScript removal is not a standard way, instead it\'s a temporary solution). If you want this, then enter HTML ID of target footer element.', 'add-scripts-short-codes-in-footer');?>

plugin_slug); submit_button(); ?>
settings_page_part("end"); ?>