Send me the page where you are taking this code from. I tried it in WordPress and on my local machine and it did not work.
There is the full code, I’m taking it from weather.com’s last page it generates after you configure your weather embed.
I could not get the code provided to work in WordPress either.
<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=e5e5e5*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>
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>
I will try this out when I am near my computer later and will report back.
Thank you for your help.
Hmm…that still did not work and I’m not sure why.
I pasted this into the WordPress page HTML editor:
<div id=”wx_module_3966″>
Malibu Weather Forecast, CA
</div>
<script type=’text/javascript’ src=’http://roadreview.net/wp-content/uploads/2009/12/MalibuJS.js’></script>
Any ideas anyone as to why this did not work?
I also tried the code with single quotes changed to double quotes and that didn’t have any effect.
Anyone have any ideas? I appreciate your time!
Anyone in the night crowd have any ideas? Thank you.
Did anyone ever get this to work? I’m trying to do the same thing.
It works exactly like PBP_Editor explained it above, he just didn’t walk you through every single detail. I will use your code from above to help explain.
You still need the link to weather.com in your html code
‘<div id=”wx_module_3966″>
Malibu Weather Forecast, CA
</div>’
Note for above, I’m new to all of this, but the code is not showing correctly above. It shows the link, but in your html code you need the entire href from the original weather.com code.
Next create an external java script using Notepad. Here is a link I found if you are unsure of how to do that. Link
In the java script file include everything in between ‘<script type=”text/javascript”>’ and ‘</script>’, but do not include the tags you will use them later.
Upload your java script file to your server, it should be in the root directory for the website. If you want to put it in a new separate folder that is fine, just take note of where you put it, how you spell it, and how you space it and capitalize it. One difference will prevent the code from working.
Now go back to your page and the html editor. This is where you insert your tags again. Insert the code
‘<script type=’text/javascript’ src=’http://yoursite.com/js/weather.js’></script>’
Note that /js/ is the folder the file is in. When I uploaded my .js file I put it in a separate Weather folder so instead I used /Weather/weather.js. Again this script is very picky. If you have capitals in your file name you need to place capitals in the code.
I hope this helps, good luck, and pay it forward.
You can check out the results on my page. Protuber.com