• Hey all,

    Whenever I add this code:

    <p id="wx_module_9781">    <a href="http://www.weather.com/weather/local/USOH0538">Macedonia Weather Forecast, OH</a></p>
    <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 = \'USOH0538\';
    
    /* 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_9781\';
    
    /* 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=728x90*WX=FHW*LNK=RCTN*UNT=F*BGI=seasonal1*MAP=null|null*DN=www.nordoniasoftball.com*TIER=0*PID=1059474963*MD5=d0497c2e94328a9868ded9c7bed2056c\';
    
    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>

    I only recieve a link on my page. It does not bring back the image. This works just fine in a normal HTML page, but not on a WP page.

    Also, whenever I use a Google maps link, it works, but then does not allow me to go back and edit the page through the admin control panel. I have to delete the contents of the column in MySQL to be able to go back and edit the page.

    <iframe width="300" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;q=8006+S+Bedford+Rd,+Macedonia,+OH+44056&amp;sll=37.0625,-95.677068&amp;sspn=55.016555,74.882813&amp;ie=UTF8&amp;s=AARTsJpOa4_FT7crKs4YIKbkcjrLzOWn7w&amp;ll=41.310437,-81.504908&amp;spn=0.019341,0.025749&amp;z=14&amp;iwloc=addr&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;q=8006+S+Bedford+Rd,+Macedonia,+OH+44056&amp;sll=37.0625,-95.677068&amp;sspn=55.016555,74.882813&amp;ie=UTF8&amp;ll=41.310437,-81.504908&amp;spn=0.019341,0.025749&amp;z=14&amp;iwloc=addr&amp;source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>

Viewing 15 replies - 1 through 15 (of 16 total)
  • You need to create a new page template. Make a copy of page.php. Call it page-wx.php or something.

    Put this code at the top:

    <?php
    /*
    Template Name: Page WX
    */
    ?>

    You can call it whatever you want, I just put “Page WX” as an example.

    You then need to pop that code in before or after the WP Loop. You can take the loop out if this code is all you want on the page. If you want to add content via the WP Dashboard, leave the loop there. And it depends on if you want that added content above or below this code where you put the code. Obviously if you want this code UNDERNEATH any added WP content, paste that code AFTER the loop.

    Save the page file and upload it to your theme directory. If you want to make edits to this code and the page template later on via the WP Dashboard:Presentations, CHMOD the file to 766.

    You should be able to view this page in all its glory now.

    Thread Starter MrBean

    (@mrbean)

    Do I want to copy the page.php in the default theme location (not using default theme by the way) or the page.php in wp-admin? Also, what you stated above, does that apply to both of my problems?

    Also, why do I have to go through all this to add simple HTML to a page? Is this normal?

    Thanks!

    1. You would copy the page.php from whatever THEME you are using. If you want to use this page in more than one theme, you have to repeat for each theme.

    2. WP pages don’t normally allow PHP from the posting area but there are plugins that workaround this, the best one of which IMHO is David Chait’s QuickPHP. It’s a simple plugin. But the code you are proposing to add is script, not “simple HTML” or PHP code. So this is the only workaround. Sorry, but it is what it is. šŸ™‚

    3. If it’s a Google Map you want to add, why don’t you search for a plugin that will do this for you. That would be the easiest thing.

    Look here:
    http://wordpress.org/extend/plugins/

    or here:
    http://www.wp-plugins.net

    Thread Starter MrBean

    (@mrbean)

    I see I see … I am still very new to WP so I still have quite a bit to learn. Are there any good plugins that can assist me with this type of situation? Or do I simply have to take the route you described above? Also, I did not see QuickPHP in either of the links you provided.

    Thanks again!

    Thread Starter MrBean

    (@mrbean)

    A bit off topic, but now that I’m starting to use some of these plugins, what exactly does a user mean when they say something like this? Make use of [findusmap] throughout your posts and pages

    After applying a modification, how exactly do I call upon it such as this one?

    http://wordpress.org/extend/plugins/find-us/installation/

    Here is quickphp.. it’s on David’s site.
    http://www.chait.net/index.php?p=310

    I’m like a kid in a candy store when it comes to WP Plugins.

    Regarding “make use of [findus]” .. usually a page based plugin is called like this:

    %%plugin%% or <!-- plugin --> or via php. I would think that maybe you just need to create a page and in the writing area (not the page template itself), just put this code [findusmap] and that should do it.

    Thread Starter MrBean

    (@mrbean)

    Awesome, thank you.

    I’ve been browsing the plugins, especially the maps and weather. I’ve got the maps tackled, but I have not yet found any good ones for weather. Any recommendations and/or any better ways to use the above script I posted earlier?

    Thanks for all your help!

    There used to be a great one for weather. You have to go in and edit it with your NOAA info (would be the TV station closest to you if I’m not mistake, but I think the documentation provides a list of those). It outputs a nice image of the current weather and even turns dark if it’s night time. Let me see if I can find that one for you. I used it some years ago, so don’t know if it’s been updated to play nice with these later versions of WP.

    Found it. Looks like it’s compatible with 2.3.3 as it’s running on the plugin dev’s site and he’s running 2.3.3.

    http://www.viper007bond.com/wordpress-plugins/weathericon/

    Thread Starter MrBean

    (@mrbean)

    haha, that’s the one I was just working on … getting it setup now …

    Thread Starter MrBean

    (@mrbean)

    I’m still not grasping something on how WP works … I’ve become so used to being able to use all code types with simple machine forums and tiny portal that I’m not understanding something here.

    So I added the plugin, configured it appropriately, and per the documentation it states to add this wherever you want it to be displayed (I want it on a page):

    <?php if (function_exists('WeatherIcon')) : ?>
         <li>Regina, Saskatchewan
             <ul><?php WeatherIcon(); ?></ul>
         </li>
    <?php endif; ?>

    Well, I added that, and obviously the php is not being picked up. Is this where I would need a php plugin working? I added QuickPhp to my site and still after I add the above code, the php is removed from the page. What am I doing wrong?

    Thanks again

    Love love love SMF and TP. My web design partner uses it on his forum, which is the largest one in his country with over a half a million active users. (He’s even in the wikipedia.) But I digress.

    That plugin is meant to be used in a sidebar, but the way QuickPHP works you append “quick” to php and substitute / for the ?.

    So this:

    <?php WeatherIcon(); ?>

    Becomes this:
    <quickphp WeatherIcon(); />

    You don’t have to have it in an unordered list like you do on the sidebar. I’d use a centered division and h3 or h4 heading.

    HTH.

    Thread Starter MrBean

    (@mrbean)

    Very cool, thank you much. The quickphp will definitely be of help, but I don’t think I’m going to use this weather plugin. Do you know of anything out there that would easily use that javascript snippet I posted earlier?

    I tried this out and doesn’t look like it worked: http://www.automateyourbusiness.com/updates/2007/07/18/javascript-in-wordpress-posts/

    Actually, after further reading, it would appear it is because of the WYSIWYG editor. This is unfortunate as the reason behing chooseing WP was to allow non-computer savvy people to be able to easily edit this page and others. I haven’t looked into it yet, but if I disable the WYSIWYG editor, what does it turn it into? Just pure code?
    Thanks again!

    Thread Starter MrBean

    (@mrbean)

    So I finally found some basic HTML out there to display weather … and it does not work on the site. When I add the HTML in the “code” section of the page, it does not allow me to go back to the “code” page and I get a broken image with linked text … I don’t get this … there is nothing complicated about this!

    <a href="http://www.4wx.com/weather.php?pands=44067"><img
    src="http://www.4wx.com/weather.php?forecast=zone&alt=hwizone7day&daysonly=3&config=png&pands=44067&hwvdisplay=" width="530" height="210" border="0" title="Click for Forecast from 4WX.COM"></a>

    I found even a way better one that I definitely want to use … when I first hit save, it works like a champ. But If I go back into the editor to update the page, it blows it to all hell!!! This is becoming amazingly frustrating …

    <div style='width: 500px; height: 440px; background-image: url( http://vortex.accuweather.com/adcbin/netweather_v2/backgrounds/green_500x440_bg.jpg ); background-repeat: no-repeat; background-color: #336633;' ><div style='height: 420px;' ><script src='http://netweather.accuweather.com/adcbin/netweather_v2/netweatherV2.asp?partner=netweather&tStyle=whteYell&logo=0&zipcode=44067&lang=eng&size=13&theme=green&metric=0&target=_self'></script></div><div style='text-align: center; font-family: arial, helvetica, verdana, sans-serif; font-size: 12px; line-height: 20px; color: #FFFFFF;' ><a style='color: #FFFFFF' href='http://www.accuweather.com/us/OH/NORTHFIELD/44067/city-weather-forecast.asp?partner=accuweather&traveler=0' >Weather Forecast</a> | <a style='color: #FFFFFF' href='http://www.accuweather.com/maps-satellite.asp' >Weather Maps</a> | <a style='color: #FFFFFF' href='http://www.accuweather.com/index-radar.asp?partner=accuweather&traveler=0&zipcode=44067' >Weather Radar</a> | <a style='color: #FFFFFF' href='http://hurricane.accuweather.com/hurricane/index.asp' >Hurricane Center</a></div></div>

    Well, I personally DESPISE the WYSIWYG editor but that’s because I write code and CSS and HTML all day and I’d rather have total and complete control over everything. (Yeah, I’m a control freak.)

    WP automatically adds <p> tags to everything natively, even without the WYSIWYG editor. It thinks it’s being helpful by doing so, but IMHO it’s just being annoying.

    Also, one good thing is that you will be able to post YouTube videos without problem without that WYSIWYG editor.

    Here’s what happens. You know how on this forum you have to enclose code (the stuff that has < and > in it) in between backticks? This is because otherwise, WP would create HTML entities such as < and > to represent those and you couldn’t copy and paste them.

    That’s the same theory behind the WYSIWYG editor and why you cannot post YouTube vids. Because all of the <embed> code is stripped out in that WYIWYG editor so you get mush when it’s brought over.

    It’s six of one, half a dozen of the other; personal preference mainly. Live without the WYSIWYG editor for awhile and see how you like it.

Viewing 15 replies - 1 through 15 (of 16 total)

The topic ‘Issues with using html on a WP page’ is closed to new replies.