A spanning tree generating function T(z) for infinite periodic vertex-transitive (vt) lattices L
vt
has been proposed by Guttmann and Rogers (2012 J. Phys. A: Math. Theor.
45 494001). Their spanning tree constants are then given by T(z = 1). Here an extended T
e
(z) is constructed, relaxing the previous vt condition to q-regular lattices L and likewise leading to z
L
= T
e
(1). Further, in the vt case the method to derive T
e
yields a new integral formula for the lattice Green function. As examples, spanning tree generating functions for all the eleven vt Archimedean (surprisingly, easier to obtain from T
e
than from T) and two relevant non-vt, martini and the (4, 82) covering/medial, lattices are derived. The importance of T
e
(and T)—beyond just being a tool to calculate z
L
—is illustrated with the proof that the free energy of the random walk loop soup model (defined from closed random walks, the loops, over L) can be written in terms of T
e
(z). From such result, it is shown that the system critical point—existing only for d = 1 and d = 2—is directly related to z
L
.