When we are creating a custom theme then we need to customize the design as per different pages. So we are trying to add the class in body tag. So for doing this,we are doing a lot of condition.But this is not good…