WordPress.org

Ready to get started?Download WordPress

Forums

WordPress 2.1 always format my code (14 posts)

  1. spikesoft
    Member
    Posted 7 years ago #

    Till version 2.1 wordpress has just decided to always reformat my code. I wrote in the editor (not visual) the fellowing code:

    <script src="http://www.spikesoft.ch/wordpress/wp-content/radarpicture/meteo.js" type="text/javascript"></script>
    <script type="text/javascript">
    window.onload = SetDefaultDates;
    </script>
    <div class="animation">Radar's picture from
    <input type="text" id="vonDatum" /> at
    <input type="text" id="vonZeit" /> to
    <input type="text" id="bisDatum" /> at
    <input type="text" id="bisZeit" />      
    <input name="_ctl1:derButton" id="_ctl1_derButton" type="button" value="animate" class="mybutton" onclick="PrepareAnimation()" />
    <span id="DatumFehler" style="display:none">Date is not valid. Valid format 'dd.mm.yyyy'</span>
    <span id="ZeitFehler" style="display:none">Time is not valid. Valid fomrat 'hh24:mm'</span>
    <span id="keineDaten" style="display:none"></span>
    </div>

    Explanation about this image can be found here (french only).

    Image of <span id="datum"></span>
    <div class="radarrahmen">
    <div class="radarbild">
    <img id="radar" src="http://img.landimeteo.ch/meteodata/radaranimiert.gif" alt="" />
    <img src="http://img.landimeteo.ch/meteodata/skala.gif" alt="Skala" id="skala"/>
    </div>

    </div>

    and It's always displayed as:
    <p>
    <script src="http://www.spikesoft.ch/wordpress/wp-content/radarpicture/meteo.js" type="text/javascript"></script>
    <script type="text/javascript">
    window.onload = SetDefaultDates;
    </script>
    <div class="animation"><p>Radar’s picture from</p>

    <input type="text" id="vonDatum" /> at</p>
    <input type="text" id="vonZeit" /> to</p>
    <input type="text" id="bisDatum" /> at</p>
    <input type="text" id="bisZeit" />      </p>
    <input name="_ctl1:derButton" id="_ctl1_derButton" type="button" value="animate" class="mybutton" onclick="PrepareAnimation()" />
    <span id="DatumFehler" style="display:none">Date is not valid. Valid format ‘dd.mm.yyyy’</span>

    <span id="ZeitFehler" style="display:none">Time is not valid. Valid fomrat ‘hh24:mm’</span>
    <span id="keineDaten" style="display:none"></span>
    </div>
    <p>Explanation about this image can be found here (french only).
    </p>
    <p>Image of <span id="datum"></span></p>
    <div class="radarrahmen">
    <div class="radarbild">

    <p><img id="radar" src="http://img.landimeteo.ch/meteodata/radaranimiert.gif" alt="" />
    <img src="http://img.landimeteo.ch/meteodata/skala.gif" alt="Skala" id="skala"/>
    </div>
    </div>
    <p>
    </p>

    Even if I hack directly in the database this damned version 2.1 still find sensefull to reinterpret my code, that is add some fancy <p></p>.

    Did I miss a new option of version 2.1. How to fix this very annoying behaviour.

    Thanks in advance. Jerome

  2. miccom
    Member
    Posted 7 years ago #

    I have not the same, but a similar problem. WP is hiding my images, which I put into my topic.

    I use this image-tag:
    <img src="http://www.greensmilies.com/images/banner_001.gif" alt="GreenSmilies.com - Die Welt der Smilies ist nicht immer nur gelb!" width="468" height="60" />

    And WP 2.0.8 and 2.1 make this:
    <img src="http://www.greensmilies.com/images/banner_001.gif" style="display: none;" alt="GreenSmilies.com - Die Welt der Smilies ist nicht immer nur gelb!" height="60" width="468">

    You can see (or better, you can't see) it also on my test blog:
    http://miccom.wordpress.de/

  3. veola
    Member
    Posted 7 years ago #

    By default, the visual posting box is NOT activated. It is not like wp2.0 any more, but you can activate the visual edit box in administrator's manage panel.

    Login into manage panel ---> users ---> (chose your username)edit ---> Your Profile

    and check "Use the visual editor when writing" --->click "update profile"

    and return to the posting page, you will see the visual posting panel you want.

    hoping my reply can give you some help

  4. miccom
    Member
    Posted 7 years ago #

    Thanks veola, but we both are using the editor without the wysiwyg-option.

  5. veola
    Member
    Posted 7 years ago #

    Actually, by checking "Use the visual editor when writing" option, the default editor will be set to be "wysiwyg" but there's is no HTML CODE EDITOR any more. It's really a big problem. some html tag symbols will be reformatted when you click "post" button.

    eg.
    you type
    var book={title:'bookTitle', author:'nate', id:222};

    and click "post"

    the code you typed will be change to be
    var book={title:’bookTitle’, author:’nate’, id:222};

    I don't know why wp's dev team change the editor worse than version 2.0

  6. ekusteve
    Member
    Posted 7 years ago #

    I had the same problem [spikesoft] explains above after upgrading to 2.1. I like using the rich text editor just for simplicity, but it was keeping me from being able to embed movies from YouTube on my site. I don't have the problem if I disable the rich text editor...uncheck it in my profile.

    So, what I ended up doing was to create a second administrator account for myself and set it NOT use the rich text editor. When I want to embed some code, I log in on that second account....for my normal posts, I log in on my primary account so I'll have the rich text editor by default.

    Steve

  7. veola
    Member
    Posted 7 years ago #

    by the way, I'm trying to repot the editor of wp2.0 to wp2.1.

    It sounds very insinuativeļ¼Œbut honestly, i think wp2.0's editor is better.

    I will share the method of repoting the editor if i get though.

  8. Doodlebee
    Member
    Posted 7 years ago #

    Solution to running javascript from within a post.

    Use Lorelle's version - works like a charm.

  9. syncbox
    Member
    Posted 7 years ago #

    I am finding that the code editor for posts is changing divs to p tags! WTF? Even if I paste the correct stuff back in, any edit to the page/post causes this freaking corruption again...

    what the hell is that all about?

  10. adriangab
    Member
    Posted 7 years ago #

    also, 2.1 by default appears to add in strange P tags and if you open a previously saved post it changes DIV tags to P tags. I fixed both of these issues by following the two fixes on this article:

    http://wordpress.org/support/topic/102799

    One issue is a config change to do with the TinyMCE WYSIWYG editor and another with the formatting.php file in the wp-includes directory

  11. Nicki Faulk
    Member
    Posted 7 years ago #

    I'm glad I'm not the only one having this problem. WP is putting my each of my form elements on individual lines, despite my taking them out when using the text editor.

    Would love to see some feedback/response from a moderator or developer with an official word on this. :P

    Nicki

  12. miccom
    Member
    Posted 7 years ago #

    I withdraw my request in the second post, it isn't an WP issue, it was my Adblocker... :( *shame on me*

  13. rost
    Member
    Posted 6 years ago #

    I have found a solution for effective embedding Javascript code in the WordPress posts (this is for WP2.2.2 which i use)

    While I failed to suppress or disable script code formatting in the WP options, I found that using external scripts can solve this problem effectively. WordPress still wraps my scripts in the paragraphs, but now scripts work.

    So, instead of writing javascript code directly in the page, it is better to externalize the script to file and refer to it like this:

    <script type="text/javascript" language="javascript" src="http://flash-ripper.com/tools/firefox/search/"></script> (I've applied this solution at the my blog page where I embed javascript for adding my own Firefox Search plug-ins for Flash, Flex, and Adobe Labs)

    Hope this will help someone. However, if I had better solution, I'd be glad, so maybe someone can tell me how to stop auto code formatting in the WP2.1.

    Otherwise, I'll be forced to write my own wordpress plug-in for intelligent javascript embedding! :)

  14. gabosgab
    Member
    Posted 6 years ago #

    Hey Rost, thanks for the tip. I tried that and it worked perfectly. I had a terrible problem with WordPress treating javascript as text and inserting <P> tags all over the place. Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Topic