  In this paper, we develop a new approach to prove the $W$-entropy formula for
the Witten Laplacian via warped product on Riemannian manifolds and give a
natural geometric interpretation of a quantity appeared in the $W$-entropy
formula. Then we prove the $W$-entropy formula for the Witten Laplacian on
compact Riemannian manifolds with time dependent metrics and potentials, and
derive the $W$-entropy formula for the backward heat equation associated with
the Witten Laplacian on compact Riemannian manifolds equipped with Lott's
modified Ricci flow. We also extend our results to complete Riemannian
manifolds with negative $m$-dimensional Bakry-Emery Ricci curvature, and to
compact Riemannian manifolds with $K$-super $m$-dimensional Bakry-Emery Ricci
flow. As application, we prove that the optimal logarithmic Sobolev constant on
compact manifolds equipped with the $K$-super $m$-dimensional Bakry-Emery Ricci
flow is decreasing in time.
