• Here’s a sample page:
    http://www.richardsorensen.com/teknikor/?page_id=40

    It’s not meant to be pretty, and it’s not my site (I can’t change the style.css file, for instance); I’m just dumping content into it by using the Page Editor, HTML tab.

    As you’ll see, there are three (visible) paragraphs. The first is normal, with some links. The second is surrounded by < code > tags, and the links are correctly commented out (I’m actually not sure if that’s right or not; shouldn’t <! — … — > be showing up in a <code> block?). In the third paragraph, I’ve commented out the links — and lost all of the paragraphs after it (AND the left-hand menu, and the footer formatting). View source to see what I mean — and see http://www.richardsorensen.com/teknikor/?page_id=2 to see what the footer should look like.

    I suspect the issue is that for some reason, the HTML tab isn’t behaving, and is substituting &#8211; for the — that precedes the end of the comment. In desperation, I’ve tried using --> instead, but that doesn’t seem to work anywhere, let alone in WP.

    So: going a little nuts! Yes, I could just cut the links and paste them back in when I need them, but it will save time to keep them there — and at this point it’s a matter of stubbornness — it SHOULD work!

    Any help MUCH appreciated!

Viewing 14 replies - 1 through 14 (of 14 total)
  • Did you even try validating the page?

    shouldn’t <! — … — > be showing up in a block?

    Comment tags are still treated like any other piece of markup on a web page – which means that they will be parsed by the browser even when they are within <code></code> markup.

    Thread Starter amateur6

    (@amateur6)

    Hello!

    Sorry, I didn’t realize that comments would be parsed within . Seems like it defeats the purpose (but I'll take that up with w3.org, not WP).

    Anyhow, when I said:

    I suspect the issue is that for some reason, the HTML tab isn't behaving, and is substituting – for the -- that precedes the end of the comment. In desperation, I've tried using --> instead, but that doesn't seem to work anywhere, let alone in WP.

    That got parsed as well, what I meant is that I'd tried & #45; & #45; > instead of -->.

    As for “even” validating the page — no, I didn’t, because the code that I was entering was fairly simple. As far as I can see, the problem seems to be the WP html tab (perhaps in conjunction with the theme; I’m not sure) — as evidenced by the fact that it’s changing -- into & #8211 on its own.

    Also — please understand that the only reason I have those three treatments on that page are for demonstration purposes; ALL I want to do is comment out several links.

    Here’s a new link for the sample page, because I need to change the first link (initial post) back to the way it should look:
    http://www.richardsorensen.com/teknikor/?page_id=641

    I’ve just tested HTML comments on one of my sites and they’re working correctly when entered via the HTML tab. WP isn’t parsing <, > or --. Make sure that you are entering the comment tags correctly:

    <!-- this is a comment -->

    If you’re still having problems when using the correct syntax, try deactivating all plugins and/or switching to the default theme to rule out any plugin or theme issues.

    I’ve had a problem with commenting out say a form tag, sic:

    <!-- <form .... > -->

    in the HTML editor on WP. Once I got rid of the < and > at the ends of the block it the parser allowed it.

    Just thought I’d add that :.)

    @esmi: this might work for one line but not for a paragraph :(.

    <!– This will work for a line –>

    <!– This will work for
    multiple lines. –>

    <!– If those don’t work
    you might want to
    add some escape characters //–>

    <comment> Some browsers require this </comment>

    @fishdogfish: Did you check it yourself?

    Apparently you didn’t.

    I can confirm jonlee4´s description. Just found that out, too.

    If the part i want to comment out is surrounded by html tags it doesn´t work.

    If there isn´t a reason why this is happening maybe it´s worth to open a ticket on trac?!

    @tinar

    I mean it should.

    I think the reason it doesn’t has something to do with the way the server strips the code down to bare bones before feeding it to the browser.

    Then again that can vary from server to server.

    Since WP is HTML embedded php why not use both comments.

    <!– /* like this

    That way everything is hidden…

    That should be hidden */ –>

    @fishdogfish It doesn’t, because I am having the same problem and I just tried it.

    I am looking for a solution to this because I do not want to remove the commented out code from my page because I plan to revisit it later and use it.

    If anyone knows of a solution, besides a plugin, which I refuse to resort to using for 1 page, I would very much appreciate it.

    can you post the exact code/content which contains these commented areas?
    and a link to see the result?

    accidental nested comments for instance will make problems.

    @alchymyth I discovered the problem is related to WordPress formatting. I was trying to comment out a div with a p inside it, but apparently it automatically puts p around anything and everything indiscriminately. So, no go. I finally gave up on it and just saved the stuff to a txt file and deleted it from the post. I didn’t like doing that, but it was the best option for me.

    It’s a pain to have to do this, but enclosing your comment within the code tag seems to work. It may not validate, or be technically correct, but it works:

    <code><!-- commented out text here --></code>

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Can’t comment out’ is closed to new replies.