Sarabjit Singh
Sarabjit Singh

Reputation: 103

How to add js in head of wordpress without using theme files or plugins

I want to add a javascript file into Wordpress but i don't want to use a plugin or any theme file like functions.php How can i do that?

I have already tried using a plugin as well as functions.php, but my client don't want to use either of these.

Upvotes: 0

Views: 975

Answers (2)

Chetan
Chetan

Reputation: 162

Add in your theme folder conman file like header, footer etc...

<script src="<?php echo get_template_directory_uri() ?>/foldername/yourfilename.js" type="text/javascript"></script>    

Thanks,

Upvotes: 1

Manish
Manish

Reputation: 138

<script src="<?php bloginfo('template_directory'); ?>/js/bootstrap.min.js" type="text/javascript"></script>

put this line before tag in footer.php Here I am using bootstrap JS. you have to first put bootstrap.js in JS folder of your theme

Upvotes: 1

Related Questions