-
▼
2012
(336)
-
▼
May
(23)
- How to Get the Title of the Blog in WordPress
- How to Convert WordPress Template for TypePad
- How to Log Into MooTools for WordPress
- How to Use WordPress Comment Plugins to Improve a ...
- How to Organize Your WordPress Blog Using Pages
- How to Import All Comments From WordPress to Blue ...
- How to Make My Pictures Not Stretch in WordPress
- How to Install Something between the Head Tags in ...
- How to Remove Topics From a WordPress Post
- How to Copy a WordPress Blog to LocalHost
- How to Disable WordPress Widgets in MySQL
- How to Upload a YouTube Video to WordPress
- How to Disable the Automatic Date on a WordPress Blog
- How to Empty Trash Posts in WordPress
- How to Change My Self
- How to Edit a WordPress Header in cPanel
- How to Manually Remove WordPress From HostGator
- How to Edit Wordpress Themes
- How to Install WordPress for a Blog on Ubuntu 10.04
- How to Add a Page Template in WordPress
- How to Import a Word Document Into a WordPress Blog
- How to Use JavaScript With WordPress
- How to Display Excerpts on WordPress Posts
-
▼
May
(23)
adsense
How to Use JavaScript With WordPress
1. Open up the 'header.php' file for your theme in a code editor. This file is found in the following location:/your-site/wp-content/themes/theme-name/Look for the ending
tag and check that the code
appears above any
tags but below all other tags between
and
. If it is not there, add that line.
2. Add your
tags to include the JavaScripts you wish to use. When the JavaScript is in an external .JS file, include it like this:
/yourscript.js'>
The above code uses
to tell WordPress to look inside your theme folder for the JavaScript. Many developers put all scripts into a folder called 'js' or 'src' to keep things organized. In such a case, remember to include that folder in the path to your script. All JavaScript that is directly on the page goes between
and
tags.
3. When using a JavaSript that depends on a library such as jQuery, MooTools or YUI, you must first enqueue that library. Static HTML websites need you to include libraries as scripts, but WordPress already contains them. Here is an example of how to enqueue jQuery:
Place the enqueue code above
to make it work properly. After enqueing, you can then include JavaScripts that use that library the same way you would include other JavaScripts in WordPress.
6:45 AM | Filed Under | 0 Comments
Comments
Popular Posts
-
1. Log in to your Weebly account. 2. Click 'Theme Editor.' 3. Click on the 'Design' tab. 4. Select 'Edit CSS/HTM...
-
1. Sign up for a publisher account at Bidvertiser. Submit basic contact information and confirm your email address to get started. 2. Lo...
-
1. Log in to your WordPress dashboard. 2. Open the 'Appearance' section on the left side of the WordPress dashboard and then cli...
-
1. Open your WordPress Dashboard in your preferred browser. It is accessed at the '/wp-admin' location of your site. For example, ...
-
Facebook Widget 1. Create a Facebook fan page for your blog, if you don't already have one. You will have to manually share content wi...
-
1. Download and install the WordPress for BlackBerry app via BlackBerry App World. Download the version that corresponds with your BlackBe...
-
1. Go to your WordPress blog's administrative control panel. 2. Click the 'Settings' button on the left-side navigation menu...
-
1. Click the 'Add Contact' button on the 'Add New Post' page. This opens the 'Add a Contact Form' page. 2. Click...
-
1. Register an account with Amazon Web Services Cloud. If you have an existing Amazon account, enter your email address in the appropriate...
-
1. Log into your WordPress.com account using your user name and password. 2. Hover your cursor over the 'My Blogs' tab at the to...
Post a Comment