Support » Requests and Feedback » Should get_header be inside The Loop by default?

  • http://wordpress.org/support/topic/30735

    It does strike me as odd that The Loop is not initialised before get_header() is called. For example, it must be a common requirement to want to add custom <meta> tags in the header based on custom fields on the post/page.

    Any comments?

    (Apologies if this has been covered before. It’s hard to search for this topic.)

Viewing 3 replies - 1 through 3 (of 3 total)
  • No, not many folks put meta tags in the header. I think dougal wrote a plugin to do that, though.

    Is that cos they don’t want to or cos it’s too hard? 🙂

    Dougal’s plugin is here: http://dougal.gunters.org/blog/2004/06/17/my-first-wordpress-plugin-headmeta I don’t believe it works for WordPress 1.5+ though – not that I’m complaing Dougal!

    Moderator Ryan Boren

    (@ryan)

    WordPress Dev

    The Loop is just an interface on top of the global $wp_query object, which is created before templates are loaded. If a query resolves to a single post, page, category, or author, the object for that single entity can be obtained with $wp_query->get_queried_object(). For a single post query, this will return the equivalent of $post. Or, you can use $wp_query->post.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Should get_header be inside The Loop by default?’ is closed to new replies.