How to Include JavaScript in PHP -
i supposed include javascript in functions.php file wordpress.
tinymce.init({ ... extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]" }); i put in functions.php, didn’t work. doing wrong?
echo '<script type="text/javascript">' , 'tinymce.init({ ... extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]" });' , '</script>' ; edit: perhaps if explained trying do. when use wordpress html editor add icons
<span class="icon-shield"></span> and switch visual editor , html editor, icons disappear. trying include bit of javascript above fix this. looked @ wp_enqueue_scripts suggested , put in functions.php, still doesn’t fix problem.
function oakwood_tinymcefix() { wp_enqueue_script( 'tiny_mce' ); echo '<script type="text/javascript">' , 'tinymce.init({ ... extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]" });' , '</script>'; } add_action( 'admin_enqueue_scripts', 'oakwood_tinymcefix' );
try using heredoc syntax this:
echo <<<eot <script type="text/javascript"> tinymce.init({ ... extended_valid_elements : "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]" }); </script> eot;
Comments
Post a Comment