WordPress.org

Ready to get started?Download WordPress

Forums

HTML Comments (not post comments) in pages & posts fail. (4 posts)

  1. eharris
    Member
    Posted 5 years ago #

    I searched through the forums for something about this, but only found a thread that was abandoned 4 months ago, and which seemed to consist mostly of heated/spiteful discussion when it was going, but no solution.

    I'm converting a static HTML site to WordPress. One page on the site is commonly updated, cyclically, in a systematic way. The easiest way I've found to do this is with HTML comments ("< ! - -" and "- - >", without the spaces). Unfortunately, when I pasted my code into a WP Page (via the HTML editor, not Visual editor), I found that the HTML close-comment string was changed to "–>" (that's "& # 8211 ;>" without any spaces). Since character entity 8211 is not the same as a double-dash, my comments aren't successfully closed out, and havoc is wreaked on the rest of the page (oddly, the comments do close at points, but not where they're supposed to, and not with the normal "- - >" string. I'm not sure how that works, but it's some XHTML quirk, I guess).

    I can work around this problem with a bunch of unpublished pages that I copy/paste text from, but that's not really an optimal solution (using three or four pages for the content of one page). A proper bug fix would be preferable.

  2. Bodhipaksa
    Member
    Posted 5 years ago #

    Having the same problem. I want to have html comments hidden in a post, but the comments appear in the content.

  3. Other than using a the css for display:none, I can't think of how to do that. The post parser does seem to eat those comments.

    <!-- Hidden! -->

  4. tannerhobin
    Member
    Posted 5 years ago #

    Ran into the same issue. I'd love to see a plugin developed for commented code and/or notes associated with each page/post. The closest I've come to finding one is Kahis's WP-Notes plugin.

    I've started to use the "Custom Fields" area for storing un-used code. It's a total hack but it's worked for what I need.

    Hope this helps.

Topic Closed

This topic has been closed to new replies.

About this Topic