Weird div tag hack messes with entire head output
-
The code snippets class file is improperly loading a div tag into the <head> and it forces the entire <head> tag to load into the page <body>.
I didn’t look to much into and I don’t think this is really a good way to do it either, but the following seems to be working as far as I can tell.
I don’t know if you’re suppose to use $in_footer within the ‘in_admin_head’ action hook, but it seems to work.
I could be missing the point of what the div is actually doing but it seems like without it the only thing that seems to not work when it’s not loaded it is the code snippets icon. So an alternative would be a new seperate function that just loads the echoed div into ‘in_admin_header’ hook.
Or this could work if the div has to be the first thing loaded in the body. I haven’t tried it, but you can achieve that with jquery inside you’re function:
?> <script type="text/javascript"> jQuery(document).ready( function($) { $('body').prepend(' code inside body tag goes here '); } ); </script> <?php
We should aslo probably check that the editor is loaded first so then the file only gets enqueued on pages that it actually load tinymce instead of every single admin page.
`if ( get_user_option(‘rich_editing’) == ‘true’) {
}`
And the correct way to add an image to the editor is through javascript itself according to tinymce ed.addButton
This may or may not work with you’re plugin though because again I’m not entirely sure what the hack is actually for in the first place
By the way, on a side note if you type the word code in the search bar on that site they have your exact same icon in icon font format.
- The topic ‘Weird div tag hack messes with entire head output’ is closed to new replies.