created new and edit post functionality