add post function and show posts on index page