How to add comment on scripts using function in wordpress?

There is a generic way to use conditional comments – for styles. But unfortunately not for scripts until #16024 will be fixed. The details are described in this answer. To make your themes scripts filterable you could use a callback on wp_print_scripts and apply a custom filter in there. /** * prints a conditional comments … Read more

TypeError: window.tinyMCE.execInstanceCommand is not a function

https://stackoverflow.com/questions/22813970/typeerror-window-tinymce-execinstancecommand-is-not-a-function Thanks to Scott B In WordPress 3.9, the TinyMCE is updated to version 4, and in TinyMCE 4, the method “execInstanceCommand” has been replaced by the method “execCommand”. For compatibility issue (with old versions of WP), you must be check the TinyMCE version and used the suitable method. In below, i changed your code. … Read more

wpColorPicker: How update colors on input value update?

I was able to solve this by looking into the inner .iris() and check that it has a .(‘color’) method that allows to set a color at runtime. Thankfully, this .(‘color’) method is supported too by .wpColorPicker(), so one can do: var new_color = $the_related_field.val(); $the_colorpicker.wpColorpicker(‘color’, new_color); to overcome the annoyance of not having an … Read more

Using shipped version of jquery

The jQuery library packed with WordPress, operates under noConflict mode. Means you can not use $ in your jQuery snippet/code. Either use jQuery instead of $. or use noConflict wrapper like this. <script type=”text/javascript”> <!– jQuery(document).ready(function($) { // your jquery function, you can use $ here. }); // –> </script>

Add js into a theme [closed]

Your code should look like this function my_scripts_styles() { wp_register_script(‘easing’, get_template_directory_uri() . ‘/js/easing.js’, ‘2014-12-030’, true ); wp_enqueue_script(‘easing’); } add_action( ‘wp_enqueue_scripts’, ‘my_scripts_styles’ ); The above code should work fine. Also don’t forget to check if you have properly specified the path to your js file. Check well that you have a functions.php and not function.php file. … Read more