Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

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

    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PRE tags’ is closed to new replies.