Hooking into get_header to replace header.php in certain files?
So, I’ve been digging around in the bp parent theme, and I realize that all I really need to do to fully customize buddypress for my project is replace the standard header.php and footer.php with customized templates, then style what’s in between to my liking.
What I’m needing to know is what you all suggest as the best way to accomplish this. I figure pulling all the files that call get_header and get_footer from the parent bp theme into my child theme and changing them individually is extremely inefficient, yes?
With this in mind, I am thinking I ought to be able to write some code in my child theme’s functions.php file that hooks into the standard get_header and get_footer hooks (which are inside all the buddypress parent files I need to amend), check if the file is of a certain type, then replace the header.php and footer.php files with the properly-customized header/footer file for that page.
1) Is this a good strategy to move forward with, or is there a better one for replacing the header.php file atop every buddypress template file without actually changing my theme’s header.php file itself? For example, say I have a communityHeader.php file that is specific to all the pages involving the BP social networking functionality, including login and registration, plus there’s a communityFooter.php that goes with those pages as well, both of which are different from my main header.php/footer.php files.
2) What would be the best method of querying each get_header hook to see if the template file asking for header.php is in fact a buddypress file or not? Is there something that easily identifies them as being different from other customized template files in my child theme? Is there perhaps a way of asking what directory the file calling get_header is in, or some other way of differentiating the various index.php files from each other?
Again, I could obviously identify each file from the parent theme that needs changing, move it and its directory into my child theme, then add the whole <?php include (TEMPLATEPATH . ‘../INSERT_APPROPRIATE_DIRECTORY_STRUCTURE/communityHeader.php’); ?> line in place of every get_header call, but this seems terribly inefficient to me.
Thanks so much in advance for any advice!
You must be logged in to reply to this topic.