Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION Where to store and include .js files?
How to add other .js libs or personal js files? Which is correct directory for them? Which file should include them?

Hi johnywhy,

They are all part of the assets folder inside your theme folder
(it is called the assets folder for a reason)

Javascript libraries and scripts go in the js folder which you can find in the assets folder
Same for your css scripts which go also in it's own css folder in the assets folder
the img folder holds only images and icons that are called by js and css scripts
if your site uses special fonts to beautify your text put them in the folder fonts
if your site uses font awesome then put its css in the css folder and put it's webfonts folder
on the same level in the assets folder, see below :

Thx, now in which file do i put my javascript file-inclusion?
Is there an index.html?

Hi johnywhy,

You put it (or better said: you call it) between the <head> and </head> tags in the

Replace your-css.css with the css you need in your website
Replace your-javascript.js with the javascript you need in your website


 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" type="text/css" href="<?php get_theme_url(); ?>/assets/css/your-css.css">
 <script src="<?php get_theme_url(); ?>/assets/js/jquery-1.7.min.js"></script>
 <script src="<?php get_theme_url(); ?>/assets/js/your-javascript.js"></script>

Won't anything in the theme folder get overwritten if the theme is updated?

What if i want the script accessible to all themes?

It seems data folder is the best place, because data is the only folder that won't get overwritten by gs updates, right?

Users browsing this thread: 1 Guest(s)