[wp-hackers] Wordpress 3.0 - the_content() in pages

Austin Matzko austin at ilfilosofo.com
Mon Jun 21 15:02:26 UTC 2010


On Mon, Jun 21, 2010 at 9:53 AM, Gavin Pearce <Gavin.Pearce at 3seven9.com> wrote:
> I'm sure it's something obvious on my behalf, but do any of you know why
> as of Wordpress 3.0, in Page Templates, you can no longer call
> "the_content()" without being in the loop, or calling "the_post()"
> first?

"the_content() is a Loop-specific template function.  You should not
expect to be able to use it outside the Loop.

> Seems a strange behaviour, as surely on a single page, there
> isn't really anything to "loop" through.

You don't have to "loop," per se, just call "the_post()" to set up the
current Loop object properties.  Perhaps the_post() should be called
prior to including singular templates, as you suggest, but if
something similar happened in the past it was undocumented behavior.


More information about the wp-hackers mailing list