Answer the question
In order to leave comments, you need to log in
How to include script via functions.php on wordpress?
<script type="2ef1d8b03fb0311f9e134e45-text/javascript">$('.selectpicker').selectpicker();</script>
Answer the question
In order to leave comments, you need to log in
You can make a dependency on the main script withwp_add_inline_script()
add_action('wp_enqueue_scripts', function() {
wp_enqueue_script( 'my_scripts', get_stylesheet_directory_uri() .'/my_scripts.js' );
wp_add_inline_script( 'my_scripts', '$(\'.selectpicker\').selectpicker();' );
});
/* Получим в HTML коде
<script type='text/javascript' src='http://example.com/wp-content/themes/mytheme/my_scripts.js'></script>
<script type='text/javascript'>
$('.selectpicker').selectpicker();
</script>
*/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question