Tag Info

Hot answers tagged

4

Actually all styles should be placed in header. So WordPress doesn't have a parameter for doing this in the wp_enqueue_style function. ADDED: OK, if you really want to do it, there is a way. You can use print_late_styles() function which is called in footer. You just need to enqueue your styles when header is already passed. So you need to find some hook ...


2

Usually it is bp-legacy-js. But if you place a buddypress.js in wp-content/themes/your-theme/buddypress/js/ this file will be taken instead. The handle will be bp-parent-js The same goes for CSS files, if you place them in /your-theme/buddypress/css/. If you place the buddypress.js in a childtheme, the handle will be bp-child-js.


1

Would you please try below code to your plugin page. if the script file is your plugin root directory. function plugin_adding_scripts() { wp_register_script('my_test_script', plugins_url('testscript.js', __FILE__), array('jquery'),'1.1', true); wp_enqueue_script('my_test_script'); } add_action( 'wp_enqueue_scripts', 'plugin_adding_scripts' );


1

Makes no difference. Despite the fact add_action doesn't actually check if the callback is indeed callable (i.e. is a valid function/class/method), PHP will first "load" function and class definitions before executing inline code, hence why you can do something like: wpse_185390_function(); // Perfectly fine, even though the function is defined "afterwards" ...


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', ...


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.



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