Without checking these links, I question the need for a PHP modification. CSS is very powerful; presuming that there is a logical division between each posting HTML wise, there is no reason why CSS cannot be used alone to change the rendering of these. Adding a class to the html will make it easier of course.
So in other words, I would suggest that this isn't a PHP issue, rather an HTML/CSS one. Is there anything in particular that I may be missing that indicates that this could be a PHP issue?
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php