Wordpress - How To Add Javascript?

ams007

Regular Member
Joined
Apr 18, 2008
Messages
200
Reaction score
43
Happy Thanksgiving!

Now, back to business. I am trying to add:

<!--Start Etology Code-->
<script charset="utf-8" type="text/javascript" src="http://pages.etology.com/js2/99999.php" language="javascript"></script>
<!--End Etology Code-->

to wordpress sidebar (preferably) between archive and blogroll. If sidebar is not possible, I would settle for placing it in a post. How do I do it?

Please help.


Sidebar code below:


<div class="navigation">

<div id="sidebar">

<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar() ) : ?>

<h2>Categories</h2>

<ul>
<?php wp_list_cats('sort_column=name&hierarchical=0'); ?>
</ul>
<h2>Archives</h2>
<ul>
<?php wp_get_archives('type=monthly'); ?>
</ul>

<h2><?php _e('Blogroll'); ?></h2>

<ul>
<?php get_links(-1, '<li>', '</li>', '', FALSE, 'name', FALSE, FALSE, -1, FALSE); ?>
</ul>

<h2><?php _e('Meta'); ?></h2>
<ul>
<li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php _e('Syndicate this site using RSS'); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>

<li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php _e('The latest comments to all posts in RSS'); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
<li><a href="http://validator.w3.org/check/referer" title="<?php _e('This page validates as XHTML 1.0 Transitional'); ?>"><?php _e('Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr>'); ?></a></li>

<li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>
<?php wp_meta(); ?>

</ul>
<?php endif; ?>
</div>

</div>
 
Last edited:
I tried just copying/pasting the code there, but it did not work.
 
You can just add it to a sidebar widget and it will work fine. I do it all the time
 
Banarm, it inserts a block of ads, kinda like adsense.

Jazz99, can you recommend a widget? I am new to wordpress ;)
 
Last edited:
This worked:

Create a new, blank text widget in Presentation > Widgets. Drag it to your sidebar. Open the widget, past the javascript source code.

Thanks for all your responses!
 
You can check this site, might help you I guess.

Code:
http://www.wordpresstraining.com
 
Try this: If you want to just edit the code in sidebar.php, make sure you enclose the javascript code in unordered list like so:

Code:
<h2>Etology Ads</h2>
<ul>
<li>
<!--Start Etology Code-->
<script charset="utf-8" type="text/javascript" src="http://pages.etology.com/js2/99999.php" language="javascript"></script>
<!--End Etology Code-->
</li>
</ul>
 
Back
Top