views:

26

answers:

2

Hi,

I've found the List Hooked Functions method to display all the elements that are contributing to the final render, but I want to see which of those functions is ultimately responsible for rendering a specific piece of output. Ideally, it would work similarly to Magento's Template Hints so the responsible code is listed right next to the resultant output.

I guess I could write a function that hooks into each event and attempts to find the last function in the chain of hooks for that particular component...

Any thoughts appreciated.

Thanks, Jonathan

+1  A: 

I think this will be very hard to do. Wordpress output comes from all over the place, many little functions that call echo on their own without notifying anything (activating no hook). If everything went through a template, you could modify the code that calls the template so it prints the name of the template first, as your Magento example seems to do. But this is not the Wordpress way, so your best attempt may be to replace all calls to echo with echo __FILE__ . ': ' . __FUNCTION__ . or something weird like that.

Jan Fabry
A: 

You may want to try "WordPress Hook Sniffer" at http://wordpress.org/extend/plugins/wordpress-hook-sniffer/ or the method mentioned at "Identifying WordPress Hooks" http://blog.aizatto.com/2010/03/14/identifying-wordpress-hooks/.

boxoft
Thanks, that's probably about as close as I'm going to find off the shelf, perhaps in combination with @JanFabry's answer above...
Jonathan Day