Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   [SOLVED] Difficulty with Javacript weather embed on pages (http://forum.bytesforall.com/showthread.php?t=4672)

Wimbledon Dec 2, 2009 12:53 AM

[SOLVED] Difficulty with Javacript weather embed on pages
 
I posted on the Wordpress.org forums here and so far have not been able to solve my problem.

According to this:
http://codex.wordpress.org/Using_Jav...Template_Files

Adding Javascript seems to be quite a hassle. I investigated the Inline JavaScript Plugin, but I don't want to disable my WYSIWYG editor.

I am trying to embed weather for various locations on different pages, and the weather.com embed fits my needs best. The problem is that it's Javascript, and I don't know how to turn this into PHP:

<div id="wx_module_3966">
<a href="http://www.weather.com/weather/local/USCA0660">Malibu Weather Forecast, CA</a>
</div>

<script type="text/javascript">

/* Locations can be edited manually by updating 'wx_locID' below. Please also update */
/* the location name and link in the above div (wx_module) to reflect any changes made. */
var wx_locID = 'USCA0660';

/* If you are editing locations manually and are adding multiple modules to one page, each */
/* module must have a unique div id. Please append a unique # to the div above, as well */
/* as the one referenced just below. If you use the builder to create individual modules */
/* you will not need to edit these parameters. */
var wx_targetDiv = 'wx_module_3966';

/* Please do not change the configuration value [wx_config] manually - your module */
/* will no longer function if you do. If at any time you wish to modify this */
/* configuration please use the graphical configuration tool found at */
/* https://registration.weather.com/ursa/wow/step2 */
var wx_config='SZ=300x250*WX=VWC*LNK=WWLD*UNT=F*BGC=e5 e5e5*MAP=CSC|null*DN=www.roadreview.net*TIER=0*PID =1135549517*MD5=1d1a5d81581d186caf25d5bea18bec5a';

document.write('<scr'+'ipt src="'+document.location.protocol+'//wow.weather.com/weather/wow/module/'+wx_locID+'?config='+wx_config+'&proto='+document .location.protocol+'&target='+wx_targetDiv+'"></scr'+'ipt>');
</script>

A member on the Wordpress.org forums posted:

---

Take the script code and save it as an external js. WordPress doesn't like the document.write directly in the post. Make sure you are in HTML edit mode.

So try this

<div id="wx_module_3966">
Malibu Weather Forecast, CA
</div>

<script type='text/javascript' src='http://yoursite.com/js/weather.js'></script>


---

Yet his advice did not work. I have tried setting the "Configure Javacript" setting in ATO to external, and that didn't change anything.

Any help is much appreciated! :)

juggledad Dec 3, 2009 05:43 AM

have you thught about using http://wordpress.org/extend/plugins/cool-weather/

Wimbledon Dec 3, 2009 10:20 AM

Thank you for the suggestion, but for this site I am adding weather onto many pages for different regions and that plugin does not allow me to specify which weather region appears on which pages.

In other words, one page will need just weather from Malibu, one page will need weather from only Santa Monica, etc.

This is why the weather.com embed seemed appealing to me.

I am confused on how to integrate Javascript on Wordpress post pages using Atahualpa.

juggledad Dec 4, 2009 05:18 AM

have you got it to work in the default theme, just to make sure it is not a 'wordpress' issue?

Wimbledon Dec 6, 2009 01:40 PM

I have decided to take a different approach and do not need any more help on this issue.

Thank you for your time and input juggledad.


All times are GMT -6. The time now is 06:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.