This function I think should be included in the blog module of Divi, instead of using a code. This is how to hide the excerpts in the post do it using the steps as suggested by one who made a comment.