Login logo and choose your logo. Author: Antonio Campos Version: 1.0.0 Author URI: https://antoniocampos.net Text Domain: ac-change-login-logo Domain Path: /languages License: GPL2 Copyright 2019 Antonio Campos (email : jantoniofcampos@sapo.pt) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // If this file is called directly, abort. if (!defined('WPINC')) { die; } require_once plugin_dir_path(__FILE__) . 'config.php'; /* Add settings menu */ add_action('admin_menu', 'ac_login_logo_admin_menu'); /* Override the login page css */ add_action('login_head', 'ac_login_css'); /* Filter to change the logo link url */ add_filter('login_headerurl', 'ac_login_logo_link'); /* Filter to change the logo title */ add_filter('login_headertitle', 'ac_login_logo_link_title'); function ac_change_login_logo_load_plugin_textdomain() { load_plugin_textdomain( 'ac-change-login-logo', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' ); } add_action( 'plugins_loaded', 'ac_change_login_logo_load_plugin_textdomain' ); /* Override the login page css */ function ac_login_css() { $uploaded_login_logo = wp_get_attachment_url(get_option(AC_LOGIN_LOGO_ID)); if ($uploaded_login_logo != "") { echo ''; } } /* Filter to change the logo link url */ function ac_login_logo_link() { return get_bloginfo('url'); } /* Filter to change the logo title */ function ac_login_logo_link_title() { return ''; } /* Add settings menu */ function ac_login_logo_admin_menu() { if (is_admin()) { add_theme_page(__('Choose Login Logo', 'ac-change-login-logo'), __('Login Logo', 'ac-change-login-logo'), 'manage_options', 'ac_login_logo_admin_menu', 'ac_login_logo_admin_page'); } } /* the admin page */ function ac_login_logo_admin_page() { if (is_admin()) { /* Scripts to allow to shoose the image */ add_action('admin_footer', 'ac_login_logo_admin_css'); echo '

' . __('Choose the image to use as login Logo', 'ac-change-login-logo') . '

'; // Save attachment ID if (isset($_POST['submit_image_selector']) && isset($_POST['image_attachment_id'])): update_option(AC_LOGIN_LOGO_ID, absint($_POST['image_attachment_id'])); endif; wp_enqueue_media(); ?>