[issue #3] move code to single.php