$5
WYSIWYG Editor - 'HTML' is disabled/inactive?
I am having an issue with the WYSIWYG editor for pages/posts. The Visual editor works fine but the 'HTML' button seems to be disabled. I am unable to switch to HTML view.
Any help is greatly appreciated.
Cheers.
WP Answers | 09/01/10 at 2:54pm
| Edit
(5) Possible Answers Submitted...
-

Last edited:
09/01/10
11:18pmAshfame says:I think you have loaded jquery 1.4.2 on admin side. To load it only on the front-end use this :
add_action ( 'init' , 'jquery_cdn' );
function jquery_cdn()
{
if ( !is_admin() )
{
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' );
wp_enqueue_script( 'jquery' );
}
}- 09/01/10 3:14pm
WP Answers says:Hi There,
Please see my code below. This is the code I am using to call in my scripts. Can you please tell me how to adjust this so the jquery won't be loaded in admin? (note: 'THEME_JS' simply points to a specific folder within my theme.
Thanks a lot.
<?php
function my_init_method() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', THEME_JS .'/jquery.min.js');
}
add_action('init', 'my_init_method');
function THEME_scripts() {
wp_enqueue_script( 'jquery');
wp_enqueue_script( 'jquery-cycle', THEME_JS .'/jquery.cycle.all.2.74.js', array('jquery'));
wp_enqueue_script( 'home-modules', THEME_JS .'/home_modules.js', array('jquery'));
wp_enqueue_script( 'THEME-custom', THEME_JS .'/THEME-custom.js', array('jquery'));
}
add_action('wp_print_scripts', 'THEME_scripts');
?>
- 09/01/10 5:01pm
WP Answers says:Any ideas? If you need a higher prize to provide me the answer just let me know and i'll bump it up. Cheers.
- 09/01/10 3:14pm
-

Last edited:
09/01/10
3:03pmMilan Petrovic says:I can't give you exact answer without seeing what's going on, but if you can't switch editors, you have JavaScript error on the page. When you fix that, it will work again. Use Firefox and Firebug to see it.
- 09/01/10 3:39pm
WP Answers says:Thanks Milan. I do indeed see a JS error:
Error: jQuery is not defined
Source File: http://www.mywebsite.com/wp-admin/load-scripts.php?c=1&load=utils,quicktags,editor&ver=6cf722b1fbb67daeae8c19b58b98d018
Line: 3
Can you please see my reply in the answer above. Would you know how to modify my script so that my jquery script does not load into admin? - 09/01/10 5:01pm
WP Answers says:Any ideas? If you need a higher prize to provide me the answer just let me know and i'll bump it up. Cheers.
- 09/01/10 3:39pm
-

Last edited:
09/01/10
3:03pmRoberto Mas says:install TinyMCE advances it has way more options
- 09/01/10 3:13pm
Roberto Mas says:did you recently install or updated a plugin? try disabeling plugins one by one to see if one of them creates a conflict
- 09/01/10 3:13pm
-

Last edited:
09/01/10
11:18pmflashingcursor says:<?php
add_action('init', 'my_init_method');
function my_init_method() {
if (!is_admin) {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', THEME_JS .'/jquery.min.js');
}
}
add_action('wp_print_scripts', 'THEME_scripts');
function THEME_scripts() {
if (!is_admin) {
wp_enqueue_script( 'jquery');
wp_enqueue_script( 'jquery-cycle', THEME_JS .'/jquery.cycle.all.2.74.js', array('jquery'));
wp_enqueue_script( 'home-modules', THEME_JS .'/home_modules.js', array('jquery'));
wp_enqueue_script( 'THEME-custom', THEME_JS .'/THEME-custom.js', array('jquery'));
}
}
?>
That should do it.Previous versions of this answer: 09/01/10 at 3:51pm
- 09/01/10 4:17pm
WP Answers says:Hi There,
Thank you for this code, however when I use the above code, the scripts no longer get loaded into the head of my main site. This does fix the HTML issue in the admin, but it breaks the javascript on the main site. Any ideas why this is so?
- 09/01/10 5:01pm
WP Answers says:Any ideas? If you need a higher prize to provide me the answer just let me know and i'll bump it up. Cheers.
- 09/01/10 10:19pm
flashingcursor says:Doh, yeah -- those is_admin's should be is_admin() ...
- 09/01/10 4:17pm
-

Last edited:
09/01/10
5:58pmDenzel Chia says:Hi try this.
function my_init_method() {
if(!is_admin()){
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', THEME_JS.'/jquery.min.js');
}
}
add_action('init', 'my_init_method');
function THEME_scripts(){
if(!is_admin()){
wp_register_script( 'jquery-cycle', THEME_JS .'/jquery.cycle.all.2.74.js', array('jquery'));
wp_register_script( 'home-modules', THEME_JS .'/home_modules.js', array('jquery'));
wp_register_script( 'THEME-custom', THEME_JS .'/THEME-custom.js', array('jquery'));
wp_enqueue_script( 'jquery-cycle', THEME_JS .'/jquery.cycle.all.2.74.js', array('jquery'));
wp_enqueue_script( 'home-modules', THEME_JS .'/home_modules.js', array('jquery'));
wp_enqueue_script( 'THEME-custom', THEME_JS .'/THEME-custom.js', array('jquery'));
}
}
//add script to theme <head>
add_action('init', 'THEME_scripts');
Please note that is_admin() is a function, to check whether it is admin or not.
And secondly you got it correct by registering jquery after deregistering.
As for other scripts, you need to register them all, before enqueuing them into the <head> of web page.
And please note, you do not need to enqueue jQuery before enqueuing other scripts,
As the code already states that the new scripts are dependent on jQuery.
So WordPress will load jQuery first follow by other scripts you registered and enqueued.
My script may have syntax error, as I did not verify on my computer.
Hope this helps.
Thanks.
This question has expired.
Current status of this question: Completed




