Changeset 2898156
- Timestamp:
- 04/13/2023 04:05:25 AM (3 years ago)
- Location:
- ideal-wp-login-logo-changer/trunk
- Files:
-
- 3 edited
-
admin/backend.js (modified) (2 diffs)
-
ideal-wp-login-logo-changer.php (modified) (12 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ideal-wp-login-logo-changer/trunk/admin/backend.js
r2576665 r2898156 1 jQuery(document).ready(function($){ 2 $('#iwllc-upload-btn').click(function(e) { 1 2 (function($){ 3 4 $(document).ready(function(){ 5 6 // Depend on saved type to hide/show color/image field 7 if( iwllc_admin.bg_type === 'color' ){ 8 $('.type_image').hide(); 9 $('.type_color').show(); 10 } 11 else{ 12 $('.type_color').hide(); 13 $('.type_image').show(); 14 } 15 16 $('.iwllc_wp_bg_select').on('change', function(){ 17 18 // Get the selected value 19 var selected_type = $(this).find(":selected").val(); 20 21 if( selected_type === 'color' ){ 22 $('.type_image').hide(); 23 $('.type_color').show(); 24 } 25 else{ 26 $('.type_color').hide(); 27 $('.type_image').show(); 28 } 29 30 }); 31 32 // Initialize color picker 33 $('.iwllc_wp_bg_color').wpColorPicker(); 34 35 // Image Popup Function 36 $('[id=iwllc-upload-btn]').click(function(e) { 3 37 e.preventDefault(); 38 var btn = $(this); 4 39 var image = wp.media({ 5 40 title: 'Upload Logo', … … 10 45 console.log(uploaded_image); 11 46 var image_url = uploaded_image.toJSON().url; 12 $('#iwllc_wp_logo_url').val(image_url);47 btn.closest('td').find('input[type=text]').val(image_url); 13 48 }); 14 49 }); 50 51 52 15 53 }); 54 55 })(jQuery); 56 -
ideal-wp-login-logo-changer/trunk/ideal-wp-login-logo-changer.php
r2629065 r2898156 3 3 Plugin Name: Custom Login Logo For WordPress 4 4 description: Change the default WordPress logo by uploading your site logo for the login page. 5 Version: 1.1. 05 Version: 1.1.1 6 6 Author: Hakik Zaman 7 7 Author URI: https://github.com/hakikz … … 22 22 23 23 /*Defining Constant*/ 24 define("IWLLC_VERSION", '1.1. 0');24 define("IWLLC_VERSION", '1.1.1'); 25 25 26 26 … … 29 29 { 30 30 register_setting( 'iwllc_change_login_options_group', 'iwllc_wp_logo_url'); 31 register_setting( 'iwllc_change_login_options_group', 'iwllc_wp_set_bg'); 32 register_setting( 'iwllc_change_login_options_group', 'iwllc_wp_bg_color'); 33 register_setting( 'iwllc_change_login_options_group', 'iwllc_wp_bg_img_url'); 31 34 register_setting( 'iwllc_change_login_options_group', 'iwllc_wp_logo_link'); 32 35 register_setting( 'iwllc_change_login_options_group', 'iwllc_wp_logo_width'); … … 47 50 48 51 $cur_logo = esc_attr( get_option('iwllc_wp_logo_url', '') ); 52 $cur_bg_img = esc_attr( get_option('iwllc_wp_bg_img_url', '') ); 49 53 50 54 ?> … … 56 60 <?php do_settings_sections( 'iwllc_change_login_options_group' ); ?> 57 61 <table class="form-table"> 62 63 <!-- Logo Section --> 58 64 <?php if( $cur_logo !== "" ): ?> 59 65 <tr valign="top"> … … 64 70 </tr> 65 71 <?php endif; ?> 66 <tr valign="top"> 67 <th scope="row"><?php echo __( 'Set Your Logo' ); ?> </th> 72 73 <tr valign="top"> 74 <th scope="row"><?php echo __( 'Set Logo' ); ?> </th> 68 75 <td> 69 76 <input type="text" id="iwllc_wp_logo_url" name="iwllc_wp_logo_url" value="<?php echo esc_attr( get_option('iwllc_wp_logo_url') ); ?>" /> … … 72 79 </td> 73 80 </tr> 81 82 <!-- Choose Background Type Section --> 83 <tr valign="top"> 84 <th scope="row"><?php echo __( 'Set Background Type' ); ?></th> 85 <td> 86 <select class="iwllc_wp_bg_select" name="iwllc_wp_set_bg"> 87 <option value="color" <?php echo ( empty( get_option('iwllc_wp_set_bg') ) || get_option('iwllc_wp_set_bg') === 'color' ) ? 'selected' : '' ?> >Color</option> 88 <option value="image" <?php echo ( get_option('iwllc_wp_set_bg') === 'image' ) ? 'selected' : '' ?>>Image</option> 89 </select> 90 <p class="description"><i><?php echo __( 'Default type is `Color`' ) ?></i></p> 91 </td> 92 </tr> 93 94 <!-- Background Color Section --> 95 <tr class="type_color" valign="top"> 96 <th scope="row"><?php echo __( 'Set Background Color' ); ?> </th> 97 <td> 98 <input type="text" class="iwllc_wp_bg_color" id="iwllc_wp_bg_color" name="iwllc_wp_bg_color" value="<?php echo esc_attr( get_option('iwllc_wp_bg_color', '#f0f0f1') ); ?>" data-default-color="#f0f0f1" /> 99 <p class="description"><i><?php echo __( 'Set your desired color, to change the login page background color' ) ?></i></p> 100 </td> 101 </tr> 102 103 104 <!-- Background Image Section --> 105 <?php if( $cur_bg_img !== "" ): ?> 106 <tr class="type_image" valign="top"> 107 <th>Current Background Image</th> 108 <td> 109 <img src="<?php echo esc_attr( get_option('iwllc_wp_bg_img_url') ); ?>" alt="Current Background Image" width="220"> 110 </td> 111 </tr> 112 <?php endif; ?> 113 114 115 <tr class="type_image" valign="top"> 116 <th scope="row"><?php echo __( 'Set Background Image' ); ?> </th> 117 <td> 118 <input type="text" id="iwllc_wp_bg_img_url" name="iwllc_wp_bg_img_url" value="<?php echo esc_attr( get_option('iwllc_wp_bg_img_url') ); ?>" /> 119 <input type="button" name="iwllc-upload-btn" id="iwllc-upload-btn" class="button-secondary" value="Upload Logo"> 120 <p class="description"><i><?php echo __( 'This Image will be displayed as background image of Login Page' ) ?></i></p> 121 </td> 122 </tr> 123 124 <!-- Logo Custom Link Section --> 74 125 <tr valign="top"> 75 126 <th scope="row"><?php echo __( 'Set Your Logo Link' ); ?> </th> … … 79 130 </td> 80 131 </tr> 132 133 <!-- Logo Width Settings Section --> 81 134 <tr valign="top"> 82 135 <th scope="row"><?php echo __( 'Width' ); ?></th> … … 86 139 </td> 87 140 </tr> 141 142 <!-- Logo Height Settings Section --> 88 143 <tr valign="top"> 89 144 <th scope="row"><?php echo __( 'Height' ); ?></th> … … 105 160 $screen = get_current_screen(); 106 161 if ($screen->id === 'settings_page_change_login_logo') { 162 wp_enqueue_style( 'wp-color-picker' ); 163 wp_enqueue_script( 'wp-color-picker'); 107 164 wp_enqueue_script( 'iwllc-backend', plugins_url( '/admin/backend.js', __FILE__ ), array('jquery'), IWLLC_VERSION, 'true' ); 165 $values = array( 166 'bg_type' => get_option('iwllc_wp_set_bg', 'color') 167 ); 168 wp_localize_script( 'iwllc-backend', 'iwllc_admin', $values ); 108 169 } 109 170 } … … 115 176 function iwllc_wordpress_custom_login_logo() { 116 177 $logo_url=get_option('iwllc_wp_logo_url'); 178 179 $bg_type = get_option('iwllc_wp_set_bg', 'color'); 180 181 $bg_color=get_option('iwllc_wp_bg_color', '#f0f0f1'); 182 183 $bg_img_url=get_option('iwllc_wp_bg_img_url'); 184 117 185 $iwllc_wp_logo_height=get_option('iwllc_wp_logo_height'); 186 118 187 $iwllc_wp_logo_width=get_option('iwllc_wp_logo_width'); 188 119 189 if(empty($iwllc_wp_logo_height)) 120 190 { … … 133 203 $iwllc_wp_logo_width.='px'; 134 204 } 135 if(!empty($logo_url)) 136 { 137 echo '<style type="text/css">'. 138 'h1 a { 139 background-image:url('.$logo_url.') !important; 140 height:'.$iwllc_wp_logo_height.' !important; 141 width:'.$iwllc_wp_logo_width.' !important; 142 background-size:100% !important; 143 line-height:inherit !important; 144 }'. 145 '</style>'; 146 } 205 206 $style = '<style type="text/css">'; 207 if(!empty($logo_url)){ 208 $style .= 'h1 a { 209 background-image:url('.$logo_url.') !important; 210 height:'.$iwllc_wp_logo_height.' !important; 211 width:'.$iwllc_wp_logo_width.' !important; 212 background-size:100% !important; 213 line-height:inherit !important; 214 }'; 215 } 216 217 if(!empty($bg_img_url) && $bg_type === "image"){ 218 $style .= 'body.login.login-action-login{ 219 background-image:url('.$bg_img_url.') !important; 220 background-repeat: no-repeat; 221 background-size: 100%; 222 background-position: center center; 223 }'; 224 } 225 226 227 $style .= ' body.login.login-action-login{ 228 229 background-color: '.$bg_color.'; 230 231 }'; 232 233 $style .= '</style>'; 234 235 echo $style; 147 236 } 148 237 add_action( 'login_head', 'iwllc_wordpress_custom_login_logo' ); -
ideal-wp-login-logo-changer/trunk/readme.txt
r2677725 r2898156 2 2 Contributors: hakik, idealwebguru 3 3 Tags: Change WP default logo, WordPress Logo change, Login Logo, Custom logo, WP admin logo, 4 Requires at least: 4.65 Tested up to: 5.94 Requires at least: 5.8 5 Tested up to: 6.2 6 6 Requires PHP: 5.2.4 7 Stable tag: 1.1. 07 Stable tag: 1.1.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 19 19 == Feature Highlights Of Custom Login Logo For WordPress == 20 20 👉 Set your website logo for the login page using **Custom Login Logo For WordPress** 21 👉 Change the background. You can add a color or image for your login page background. 21 22 👉 You can set the width and height of the logo from settings panel 22 23 👉 By default, the login logo will not redirect to wordpress.org rather than redirect to your site. … … 61 62 == Changelog == 62 63 64 = 1.1.1 [13-04-2023] = 65 * Feature: Change the Backgroud of the login page. Can be added color/image for the background of the login page. 66 * Dev: Improved the script. 67 * Compatibility: WordPress 6.2. 68 63 69 = 1.1.0 = 64 70 * Feature: Display current Login Logo in plugin setting page.
Note: See TracChangeset
for help on using the changeset viewer.