Difficult to child theme, some suggestions
-
Actually, it’s impossible without modifying the parent. You also “pollute” the global space with a bunch of constants never used anywhere other than within functions.php, and even then once or zero times.
Consider two things?
1)
On your includes, use a function to include the file:function uniform_include_file( $file ) { $parent = trailingslashit( get_template_directory() ); $child = trailingslashit( get_stylesheet_directory() ); $file = file_exists( $child . $file ) ? $child . $file : $parent . $file; if ( file_exists( $file ) ) { include_once( $file ); } else { throw new Exception('File does not exist: ' . $file); } }
Or something like that. That would allow child themes to use their own versions of your include files.
2)
I think a better way would be to make all or most of your functions pluggable:if ( ! function_exists( 'function_name' ) ) { function function_name() { .... } }
3)
You might consider making the content of some sections filterable, or call for them via a pluggable function. For example, the slider on the home page. I wouldn’t need a child theme version of thatsection-homesider.php
if I could pass parameters to change theWP_Query
call.4)
Allow the use of excerpts in your front page sections.
- The topic ‘Difficult to child theme, some suggestions’ is closed to new replies.