Change script type and src of plugins in theme
Change script type and src of plugins in theme
Change script type and src of plugins in theme
You can change it by calling add_data method of $wp_scripts object. This object holds all scripts and information how to render it. To force rendering script in the footer you can do it like this: add_action( ‘wp_enqueue_scripts’, ‘wpse8170_enqueue_scripts’ ); function wpse8170_enqueue_scripts() { $GLOBALS[“wp_scripts”]->add_data( ‘jquery’, ‘group’, 1 ); } P.S.: I haven’t tested it, but suppose … Read more
On your SCROLL.JS file, add the line before anything else, (function($){ And after everything else })(jQuery); This block will load you code after jQuery is loaded, and will avoid the errors.
I found the problem…. I ran main.php like: function run_this(){ include’path/to/other.php’; } add_shortcode(‘shortcode’, ‘run_this’); And most of the content of other.php came up exept the hooks did’nt work then i tried using add_action(‘init’, ‘run_this’); and then it worked…. exept that i get a fatal error that i cant redeclare some functions twice 😀
I have not directly an answer to solve your issue as it (please take a look at the edit part I add), but this codesnippet (function) could maybe help you to solve the version issues for .js as well for .css files. /** * Remove query (output)string from .js / .css * Using filters */ … Read more
Choose the right place in (rendering-)time First off, you are hooking at init, while you want to add your callback on wp_enqueue_script. Example: add_action( ‘wp_enqueue_script’, function() { wp_deregister_script( ‘jquery’ ); // Rest of logic }Â ); Staying up to date with core Also, you might want to use the correct version that core uses. I know, … Read more
Well it works the same in the case where you tested it. The answer could actually be somewhat complex, but mainly having it inside an action callback only registers them when needed, just putting it inside the functions.php it happens always when the theme is active. First of all this can be a waste of … Read more
I was missing the <?php wp_footer(); ?> call at the end of the footer.php file.
According to https://github.com/radekzz/wordpress-react-in-theme, you can just include script as Babel type, not JavaScript if you don’t want to use webpack to print JSX. But in this case your code will not be compiled.
get_template_directory looks in the parent theme for files. In the case a child theme is being used, the absolute path to the parent theme directory will be returned. Use get_stylesheet_directory() to get the absolute path to the child theme directory. http://codex.wordpress.org/Function_Reference/get_template_directory This file is not meant to be replaced. You will need to find another … Read more