Tag Info

Hot answers tagged

2

You asked the question a long ago but I was looking for something similar and found a solution. Enqueue an admin side script on post edit screens(where we have tinyMCE). Then use the code below: (function($) { 'use strict'; $(document).ready(function() { $(document).on( 'click', '#mce-modal-block', function() { ...


2

It's not showing because the .insertAfter() and .show() functions are called on resize events only, while mobile devices do not resize. They already load the page with their mobile sized. Just make sure you also run the code on the ready event: <script type="text/javascript"> /* to show back the left side bar back when the LEFT side bar is moved ...


1

jQuery is already loaded with WordPress, so you won't need <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> When using jQuery with WordPress, you'll likely require no-conflict wrappers : https://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_Wrappers There are likely JS errors ...


1

Try to add the code to the footer using add_action('wp_footer', 'front_js', 99); where 99 specifies the order in which the functions are executed. Now it should be executed after your scripts are loaded.


1

Your snippet seems mostly ok, except that dependency is a list and should be array('jquery'). Also wp_enqueue_scripts should be use as more appropriate. You can check out Codex documentation for a complete example, see Example of Automatic Dependency Loading.


1

Use wp_register_script & wp_enqueue_script to enqueue the scripts the right way. add_action( 'wp_enqueue_scripts', 'enqueue_my_script' ); function enqueue_my_script() { wp_register_script( 'my-script', get_template_directory_uri() . '/cycle2.js', array( 'jquery' ) ); wp_register_script( 'enq-jquery', ...



Only top voted, non community-wiki answers of a minimum length are eligible