Pass parameter to get_sidebar() from a plugin.
-
Hello,
I’m building a plugin that needs to determine whether the page being viewed is a single page (as determined by
is_single()
). Ifis_single
evaluates to true, then I need to use my custom sidebar. If false, then the default sidebar. Theis_single
part is easy enough… but I am at wit’s end trying to figure out how to change theget_sidebar()
toget_sidebar('custom-sidebar')
without modifying the theme files.I don’t want to hack the theme files in any way.
I think Kaiser has it fairly close over at stack exchange (https://wordpress.stackexchange.com/questions/64492/change-which-sidebar-get-sidebar-gets-from-functions-php), but I can’t get that to work.
I am reaching out here as a final effort at finding an answer- not a first. I’m starting to think that what I want to do can’t be done, but it seems like with all of WP’s thousands of hooks, there should be some hook or filter for something like this.
Thanks.
- The topic ‘Pass parameter to get_sidebar() from a plugin.’ is closed to new replies.