Moved a function to posts.php