We construct an analog of the classical theta function on an abelian variety for the closed 4-dimensional symplectic manifolds that are T2-bundles over T2 with the zero Euler class. We use our theta functions for a canonical symplectic embedding of these manifolds into complex projective spaces (an analog of the Lefschetz theorem).