[wp-hackers] Is there a reason get_header/sidebar/footer() do nothave filters?

John Blackbourn johnbillion+wp at gmail.com
Tue Dec 10 23:06:06 UTC 2013


+1.

http://core.trac.wordpress.org/ticket/20287


On 10 December 2013 23:03, Josh Pollock <jpollock412 at gmail.com> wrote:

> I recently went looking for the filter to change which sidebar is outputted
> and was a little shocked to find there are no filters in get_sidebar() or
> in get_header() and get_footer(). Does anyone know if this was a conscious
> choice or not? If so, what was the reason?
>
> I'd be happy to write a patch to add some, but I'm wondering if there is
> some valid reason I'm missing for not using them?
>
> What I really want to be able to do is something like this:
>
> `
> function mobile_sidebar( $name ) {
> if ( wp_is_mobile() ) {
>      $name = mobile;
>   }
> }
> add_filter( 'the_sidebar', 'mobile_sidebar');
> `
>
> This would allow me to add different markup to the sidebar on mobile, to
> change its size, location, use a jQuery plugin to make the sidebar slide in
> and out, etc. I could also change which widget area is shown or show no
> sidebar at all.
>
> Thanks,
> Josh
> _______________________________________________
> 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