I am modifying my personal blog at the moment, which is based on Wordpress. My first problem was removing all indentations and whitespace, which I did fine, as so:
The 'posts' function being:
The problem is, if I wish to place code into a post, using the <pre> tags, all the changes of that function apply to it; removing neccersary indentations and such, which I don't want.
How can I make it so the function ignores everything inbetween the <pre> tags, but applies itself to everything else?
Code:
<?php ob_start("posts"); ?>
//Content
<?php ob_end_flush(); ?>
The 'posts' function being:
Code:
<?php
function posts($source) {
$find = array(
"\n",
"\t"
);
$replace = array(
"",
""
);
return str_replace($find, $replace, $source);
}
?>
The problem is, if I wish to place code into a post, using the <pre> tags, all the changes of that function apply to it; removing neccersary indentations and such, which I don't want.
How can I make it so the function ignores everything inbetween the <pre> tags, but applies itself to everything else?