A few days back i posted on how to create a small place on top of your posts in your theme to keep a featured post there (just like the one running here, as you can see on top of the posts). Validating my blog today against different browsers i stumbled on a serious mistake i did. On that tutorial there is a line of code saying:

<?=substr($featured->post_content, 0, 500);?> […]

That has a serious bug that’s lurking around not ready to be found at all. This line shortens the post to the first 500 characters so it will appear like an excerpt. But here is the problem. When using a “more” tag to cut your posts the following text is inserted in the post:

<!- - more - ->

The problem is when the cutting of the text stops just after the:

<!- -

There is the problem. The above character sequence is the markup for HTML indicating that the text following is comments! There, the parsing stops. So, after that point your page will not render. That is a major problem as you can imagine. I have a fix for it though. Please replace the above line of code with this one:

<?=substr(str_replace('<!--  more -->', '', $featured->post_content), 0, 500);?> […]

This code makes an extra callto the str_replace function replacing the more tag with the empty string. This way, there is no way a problem like that can occur. Hope it didn’t happen to you guys because it’s scary! If you encounter any more problems please report them back to me!