[wp-hackers] Including javascript in the footer

Otto otto at ottodestruct.com
Wed May 11 13:57:06 UTC 2011


On Wed, May 11, 2011 at 2:01 AM, Philip Walton <philip at philipwalton.com> wrote:
> Also, if we're talking about the "right" way to do it, in my situation
> (granted you aren't seeing what I'm trying to do) I believe it's much more
> hackish and work-around-ish to move that decision to before the
> wp_enqueue_scripts hook.
>
> I would understand doing so if WordPress were unable to add this
> functionality, but to categorically say there is no situation where it could
> be the "right" way to go seems to go against the spirit of what we're all
> trying to do.

I'm going to go ahead and categorically state that there is no
situation where it is *necessary* to enqueue a script halfway down the
page. All the normal data is loaded into memory, the main query has
executed, the autoloader has occurred for options... what else do you
need?

Starting the Loop early to look ahead at the content that will be
displayed on the page, following by calling rewind_posts() to reset
the Loop for later is not "hackish". It's obvious. We have
rewind_posts() for a reason, you know.

-Otto


More information about the wp-hackers mailing list