Tag Info

New answers tagged

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

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' );


0

Default wp_enqueue_[style/script]() behavior The default value for the $version argument of wp_enqueue_style() is false. However, that default just means that the stylesheets are given the WordPress version instead. Solution Thanks to "Remove version from WordPress enqueued CSS and JS", I learned the undocumented fact that passing in null as a version ...


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.


0

The first example is correct. Only if you use a child theme you need to use get_stylesheet_directory_uri() instead of get_template_directory_uri(). I assume there is another problem elsewhere. You should check your PHP error log.


0

Try changing wp_enqueue_script() to wp_register_script() and then after that add wp_enqueue_script('wowjs');


0

You can hook into an action after the main query has run and determine if you need to load your styles and scripts. add_action('template_include', 'custom_template_include'); function custom_template_include($template) { if (is_single() || is_page()) { global $post; if (has_shortcode($post->post_content, 'your_short_code')) { ...



Top 50 recent answers are included