[wp-hackers] adding action to get_footer, get_header etc.

Aaron Jorbin aaron.jorbin at gmail.com
Wed Jun 3 16:49:52 GMT 2009


That's correct Peter.

Using Get_Header as an example:

<code>
function get_header( $name = null ) {
       do_action( 'get_header' );

       $templates = array();
       if ( isset($name) )
               $templates[] = "header-{$name}.php";

       $templates[] = "header.php";

       if ('' == locate_template($templates, true))
               load_template( get_theme_root() . '/default/header.php');
}
</code>

so for example a template could have get_header('home') set in there
theme template to use the header-home.php file, but when adding an
action to get_header, I can't figure out how to use $name variable
that would be set to 'home'.

Did this clear up your confusion Scribu?

Thanks,
Aaron
aaron.jorbin at gmail.com
http://aaron.jorb.in
Twitter: @aaronjorbin




On Wed, Jun 3, 2009 at 8:43 AM, Peter Westwood
<peter.westwood at ftwr.co.uk> wrote:
> I think what he wants is the name for the sidebar passed to the filter.
>
> I'll look in to this soon
>
> --
> Peter Westwood
> http://peter.westwood.name
>
> On 3 Jun 2009, at 11:25, scribu <scribu at gmail.com> wrote:
>
>> I don't understand what this name variable is supposed to be.
>>
>> Maybe you need to use current_filter() which tells you what hook is
>> currently fired. Or maybe has_filter().
>>
>> On Wed, Jun 3, 2009 at 1:15 AM, Aaron Jorbin <aaron.jorbin at gmail.com>
>> wrote:
>>
>>> Hi,
>>> I was wondering if anyone new of a way to either use the $name
>>> variable or similarly find it out when adding an action to one of the
>>> get template tags (get_header, get_footer, get_sidebar)?
>>> Thanks,
>>> Aaron
>>>
>>>
>>> aaron.jorbin at gmail.com
>>> http://aaron.jorb.in
>>> Twitter: @aaronjorbin
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>
>>
>>
>> --
>> http://scribu.net
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list