[wp-hackers] trying to understand the Admin API ... changing default values for visible Screen Options

Tom Ransom lists at 1bigidea.com
Tue Dec 16 17:44:47 GMT 2008


You'll want to drop a javascript in the wp-admin footer - that does  
what you want.

The relevant code from wp-admin/common.js is

	// screen settings tab
	$('#show-settings-link').click(function () {
		if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) {
			$('#contextual-help-link-wrap').addClass('invisible');
		}
		$('#screen-options-wrap').slideToggle('fast', function(){
			if ( $(this).hasClass('screen-options-open') ) {
				$('#show-settings-link').css({'backgroundImage':'url("images/ 
screen-options-right.gif")'});
				$('#contextual-help-link-wrap').removeClass('invisible');
				$(this).removeClass('screen-options-open');

			} else {
				$('#show-settings-link').css({'backgroundImage':'url("images/ 
screen-options-right-up.gif")'});
				$(this).addClass('screen-options-open');
			}
		});
		return false;
	});

----------------------------------------
It doesn't appear that the condition of the Screen Options tab  
persists from session to session. So dropping a custom jQuery code  
should see which class it has when it executes and set the desired  
action. If you want to persist the status - you could have a simple  
Ajax call to a function in your plugin - that stored the status in a  
Option.


- Tom Ransom


On Dec 16, 2008, at 8:11 AM, Mindshare Studios wrote:

> I've been checking out the code in wp-admin/includes/template.php  
> looking
> for a hook that will allow me to set the default visibility for admin
> "Screen Options" in 2.7 via a plugin. Can anyone point me in the right
> direction?
>
>
>
> Thanks,
>
> Damian Taggart
>
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list