[wp-testers] HTML Source Editor blank

Ryan Boren ryan at boren.nu
Thu Sep 14 19:18:39 GMT 2006


Podz wrote:
> Ryan Boren wrote:
>> Podz wrote:
>>> Ryan Boren wrote:
>>>> Pop-up the Javascript Console and see what it has to say when you open
>>>> the Source Editor.
>>> Error: too much recursion
>>> Source File: http://domain.net/wp-includes/js/prototype.js?ver=1.5.0
>>> Line: 499
>> Do you have a plugin that bundles prototype enabled?  Older versions of
>> prototype can cause this.
> 
> Ah.. the theme - lowstream2 - has effects / objects / prototype /
> scriptaculous js inside it's own folders.
> Changing to Classic means I get the Source editor window to work correctly.
> 
> Which is still a bug because why is admin picking up theme code?

A theme's functions.php is always loaded, even for the admin.  That's 
because some themes need it for creating preference pages.  Ideally, 
themes would load the JS only when their preference page is loaded. 
Doing this is a bit awkward in 2.0, but 2.1 makes it much easier with 
some new hooks.  Here's some sample code:

function theme_mod_init() {
	$page = add_theme_page("Custom Image Header", "Custom Image Header", 
'edit_themes', basename(__FILE__), 'theme_mod_page');

	add_action("admin_print_scripts-$page", 'theme_mod_js_inc');
}
add_action('admin_menu', 'theme_mod_init');

function theme_mod_js_inc() {
	wp_enqueue_script('scriptaculous');
}


More information about the wp-testers mailing list