-
Book Overview & Buying
-
Table Of Contents
WordPress 2.8 Themes Cookbook
By :
Although you can certainly link to your JavaScript files directly (and in some cases, you may need to, for one reason or another), the preferred method of generating script tags for your theme is to add references programmatically. This allows for the reuse of popular scripts, and ensures that a script is not linked to twice within the same page.
You need to have created a WordPress theme that contains at least a style.css file and an index.php file. Inside the template file containing your theme's<head> tag, you need to call the wp_head function. If you have also completed the previous example, open up the header.php file (or whichever file you placed the<script> tag code in) and remove the code added in the last recipe.
First, you must create a JavaScript file to link to. This file will reside within your theme. Open your theme's folder and create a js folder. Inside the js folder, create a...
Change the font size
Change margin width
Change background colour