#wpadminbar { top: -28px; } html { margin-top: 0px !important; }\r\n"; } else { echo ""; } echo ""; } // Add a little admin css - opacity set to zero for admin bar tab as it displays better function jq_min_add_admin_css() { $options = get_option('jq_min_options'); $normal_opacity = ((float)$options['drp_admin_opacity_normal_value'])/100; $hover_opacity = ((float)$options['drp_admin_opacity_hover_value'])/100; if (isset($options['chk_wpadmin'])) { $maximised = $options['chk_wpadmin']; } else { $maximised = '0'; } if ( $maximised != '1' ) { echo "\r\n"; } else { echo ""; } echo ""; } // Delete options table entries ONLY when plugin deactivated AND deleted function jq_min_delete_plugin_options() { delete_option('jq_min_options'); } // Define default option settings function jq_min_add_defaults() { // This function updates the Plugin options with the specified defaults ONLY // if they dont exist. If an option already exists then it is NOT overwritten. // Get a copy of the current theme options $current_options = get_option('jq_min_options'); // Default options include any new optins added since last Plugin update $defaults_options = array( "chk_front_end" => "0", "chk_wpadmin" => "0", "drp_front_opacity_normal_value" => "20", "drp_admin_opacity_normal_value" => "0", "drp_front_opacity_hover_value" => "70", "drp_admin_opacity_hover_value" => "70" ); // *Important* Any checkboxes you need to be ON by default just add them to an array as // shown below, but with a "0" value. Otherwise when the Plugin is deactivated/reactivated // the ON by default checkboxes will always be set to ON even if the user set to off. //$default_off_checkboxes = array( "chk_front_end" => "0" ); //$current_options = array_merge($default_off_checkboxes, $current_options); // If there are no existing options just use defaults (no merge) if ( !$current_options || empty($current_options) ) { // Update options in db update_option('jq_min_options', $defaults_options); } // Else merge existing options with current ones (new options are added, but none are overwritten) else { // Merge current options with the defaults, i.e. add any new options but don't // overwrite existing ones $result = array_merge($defaults_options, $current_options); // Update options in db update_option('jq_min_options', $result); } } // Add admin menu page function jq_min_add_options_page() { add_options_page('Admin Bar Minimiser Options Page', 'Admin Bar Minimiser', 'manage_options', __FILE__, 'jq_min_render_form'); } // Draw the menu page itself function jq_min_render_form() { ?>
'.__('Settings').''; // make the 'Settings' link appear first array_unshift( $links, $jq_min_links ); } return $links; }