Opened 16 years ago
Closed 16 years ago
#10232 closed enhancement (invalid)
Add new hooks called after template parts are loaded
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.8 |
| Component: | Template | Keywords: | has-patch |
| Focuses: | Cc: |
Description
At this moment functions get_header() and other similar ones do actions get_header, etc. at the beginning. I have changed them (see attached patch) to also do post_get_header, etc. actions at the end.
In particular I need post_get_sidebar action for my plugin, to distinguish cases when loop_start/loop_end actions are called for main post list from these in sidebar widgets.
Attachments (2)
Change History (10)
#1
@
16 years ago
- Milestone 2.8.1 deleted
- Resolution set to invalid
- Status changed from new to closed
#3
@
16 years ago
sirzooro: Do you have any objections to the idea of using loop_start? Do you have a specific use which would make sense for extra hooks? (If so, reopen)
#4
@
16 years ago
My understanding of his report is he's love to use loop_start/loop_end, but didn't know how to check whether we're in the main loop or not. Maybe we should document this somewhere in the codex or the php docs.
#5
@
16 years ago
@Denis: you are right. I will check your suggestion later today. Hope it will work as expected :)
#6
@
16 years ago
- Milestone set to 2.8.1
- Resolution invalid deleted
- Status changed from closed to reopened
I have checked following code but it does not work as expected - test string was displayed above posts and above entries in recent post list. Could you check this?
function loop_start_handler() {
global $wp_query, $wp_the_query;
if ( $wp_query === $wp_the_query ) {
echo '<p style="color:red">TEST</p>';
}
}
use the loop_start and loop_end hooks.