• My goal is to basically get all of my outputted XHTML to be properly indented. I don’t care as much about how the php is structured since I’m pretty much the only one who looks at it…
    I’ve managed to change things around in my index.php to get everything except for the_content to behave. An added twist to this is that I have taken off the auto formatting with:
    remove_filter('the_content', 'wpautop');
    and when you view the source on my page, everything under the_content has been pushed all the way to the left, with no indentations.
    I’m sure it’s probably simple, but I’d like to write a plugin that filters the content, and adds a given number of tabs to the beginning of each line so I can have it all align properly when people look at the source.
    If you happen to know where the wpautop function lives, that may help too…thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter elasticdog

    (@elasticdog)

    Yarrr…tried to edit it and fix it, but that didn’t quite do it. Here we go again:

    function indent_content($text) {
    $lines = explode("\n", $text);
    foreach ($lines as $line) {
    if ("" == $line) {
    $fixed_text = $fixed_text.$link."\n";
    } else {
    $fixed_text = $fixed_text."\t\t\t".$line."\n";
    }
    }
    return $fixed_text;
    }

    Not sure I understand, are you trying to indent the source code itself in the XHTML, or how it appears on your webpage?

    Thread Starter elasticdog

    (@elasticdog)

    Trying to indent just the source code…I’d like for it all to be properly indented, but can’t figure out how to test for the blank lines. If you go to https://elasticdog.com/ it’s indenting the code in between the entry <h3> and the “posted”

    Thread Starter elasticdog

    (@elasticdog)

    I figured it out…it was inserting a carriage return on the lines, thus when I trimmed those off, it all started working. Darn Unix/Windows return differences.
    Not that it would probably be too helpful to anyone else, but I may publish it as a plugin for anyone to use…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to indent all of the_content?’ is closed to new replies.