WordPress.org

Ready to get started?Download WordPress

Forums

PRE tags (4 posts)

  1. manrillablog
    Member
    Posted 6 years ago #

    Is it true that there's no way to display < pre > tags in WP? This seems odd...

  2. slaughters
    Member
    Posted 6 years ago #

    My experience is that it is almost impossible to use PRE tags in WordPress.

    In the Post editor there is a "CODE" tab you can click on to to enable a "CODE" editor which lets you insert HTML tags. It's here that you can insert the PRE tag.

    BUT

    The second you save the code it returns you to the GUI editor which then collapses all your spaces. This makes indentation in your code impossible to achieve. Every single line inside a loop, an if statment, etc.. all start in column one.

    In my opinion WordPress has become impossible to use for people who want to write and share code snippets.

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    I use pre tags just fine. In combination with a syntax highlighter plugin, they're very handy.

  4. eeried
    Member
    Posted 6 years ago #

    Hello, I have read the part of the codex about how to display code, and they say you can display whatever code like HTML element with their tags (h1 etc). In fact this is how pre works.

    But as yu say WP is really weird and displays the title h1 instead of just the code.

    On wordpress.com they have a special tag that makes your code rather elegant but doesn't produces very good XHTML code (since it uses the name attribute which is deprecated I thinK in XHTML).

    Have a look here: XHTML...

    On the contrary in my "real" WP article the code vanishes. it is quite annoying. Any workaround or do we have to give up WP (I got WP 2.5.1

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags