Opened 17 years ago
Closed 17 years ago
#6945 closed enhancement (wontfix)
Add wp_header hook
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.5.1 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
This new hook should be called just after <body> tag is printed. I am going to print some HTML code at the very beginning of every page, without the need to change every theme I use.
This new function will be a great addition for Header-Footer plugin (http://wordpress.org/extend/plugins/header-footer/) too.
Change History (9)
#2
@
17 years ago
+1 for wontfix
In addition to what Viper007Bond said, a wp_header hook could create confusion with the existing wp_head hook.
I am going to print some HTML code at the very beginning of every page, without the need to change every theme I use.
Since this is a theme hook, you'd have to change your themes anyway.
#3
@
17 years ago
- Milestone 2.7 deleted
- Resolution set to wontfix
- Status changed from new to closed
Gonna just close this as "wontfix". There hasn't been any reporter feedback and I think my point is valid.
#4
follow-up:
↓ 6
@
17 years ago
- Resolution wontfix deleted
- Status changed from closed to reopened
@Viper007Bond: I haven't responded yet because I assumed that your comment was a general opinion and it doesn't require any response from my side. My fault :)
@JohnLamansky: I haven't pointed this earlier, but this change would be useful if you use single WP installation to handle multiple domains (e.g. WP MU) - in this case this feature would be the only way to add html code just after <body> if you want to reuse themes on blogs.
I know that wp_header name may be confused with existing wp_head, but on the other hand it is consistent with wp_footer. Of course you can use a better one if you have it.
#5
@
17 years ago
I tend to agree with the wontfix close.
The theme itself needs to add the hook, and adding it to the default themes will have little use in terms of mass-adotption.
If a WPMU hoster wants to use that hook, then they can add it to the themes they offer, Chances are, It'd be a fair ammount of time until most general themes added it at all.
#6
in reply to:
↑ 4
@
17 years ago
Replying to sirzooro:
[T]his change would be useful if you use single WP installation to handle multiple domains (e.g. WP MU) - in this case this feature would be the only way to add html code just after <body> if you want to reuse themes on blogs.
There's another patch somewhere for changing the way "child themes" work. Rather than only being able to overwrite CSS nad basing the HTML on another theme, you would be able to write, for example, a header.php file for the child theme and it will override the corresponding file from the parent theme.
I would check into that -- it's an excellent fix for exactly the situation you describe.
#8
follow-up:
↓ 9
@
17 years ago
Why is this open?
Since it seems to be a theme issue, it is entirely possible that themes won't include this hook. It also seems to be a simple issue to add the hook to any theme you are using.
#9
in reply to:
↑ 8
@
17 years ago
- Keywords dev-feedback removed
- Milestone 2.7 deleted
- Resolution set to wontfix
- Status changed from reopened to closed
Replying to jacobsantos:
Why is this open?
Because the reporter reopened it.
Gonna close it (again) as there seems to be a general consensus that the hook isn't needed but more importantly even if it was added to the distributed themes, no other themes would ever have it.
Unlike core files, themes are easily edited so you can add hooks/functions wherever you need them.
-1. Very fringe case and I don't see the hook being used on a regular basis. Plus, since this is a theme hook, it's up to the theme developer to add the hook to their theme. I still very often come across themes without the head and footer hooks and those have been around since the dawn of time.
If you need this just for your site, then just modify your themes you use. Hooks aren't registered anywhere -- you can make up your own ones. Just add
<?php do_action('your_hook'); ?>
to each of your themes and then use the hook.If you're writing a plugin to be distributed, then you should either have the user edit their theme and add a function where they want your plugin to output or you should use
ob_start()
or whatever it is to add in the HTML yourself.Recommend "wontfix".