1

I want to include an optional template part in the theme which requires some jQuery plugin. Is it ok to include the wp_enqueue_script in that specific file? Or it should always be included in the functions.php file?

Also, is it ok to write some javascript code in that specific file? The script works, but my question is about WordPress coding standard.

1

1 Answer 1

1

I prefer to enqueue it to the get_template_part_{$slug} action to keep all the scripts in one place & more organized. But you can do it either way you like

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.