I’m building a plugin that needs to determine whether the page being viewed is a single page (as determined by is_single()). If is_single evaluates to true, then I need to use my custom sidebar. If false, then the default sidebar. The is_single part is easy enough… but I am at wit’s end trying to figure out how to change the get_sidebar() to get_sidebar('custom-sidebar') without modifying the theme files.
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.