[wp-testers] Custom head meta data

David House dmhouse at gmail.com
Fri Dec 23 11:21:28 GMT 2005


On 22/12/05, Alex Biddle <heuristic at gmail.com> wrote:
> Was wondering if the new version of Wordpress will have custom <head>
> functionality. Ie. If you include a javascript file that is only going
> to be used in one post, you only have to have the script included in
> the <head> of that post; not in the template header.

You could write a plugin to do this. It would need to hook into
wp_head and echo the <script> tag if is_single() returns true and
$post->ID was what you need it to be. (remember $post is a global
variable, so you'll need to put 'global $post' at the top of the
function).

If you wanted to generalise, someone could write a plugin which
inserted a little widget in the post screen that allows people to
enter some custom HTML. The plugin could then hook wp_head when
is_single(), see if any code is associated with the current post ID,
then if so, echo it.

--
-David House, dmhouse at gmail.com, http://xmouse.ithium.net


More information about the wp-testers mailing list