Hi Alex,
I didn't want to use child classes in the parent, but parent classes in the child. So I installed Composer in the child theme as well and, as it turns out, it works: I can use classes specifically created for the child theme, using the child's namespace, but I can also use the parent's classes, using the parent's namespace. In other words, I can do this in any template file:
use parent\Modals;
use child\OppDetails;
Pretty great. The only thing that's not working is the child's theme init
class. I have an init
class in the config
folder of the child theme, and in my functions.php
file I have:
if ( class_exists( 'child\\init' ) ) :
new \child\init();
endif;
But the conditional returns false. If I put an echo
statement in the block, it doesn't print... I don't understand why it doesn't find the class, since the file is there and the names of both the file and the class are correct (I double checked). Is there some other Composer setting I should modify to make this work? After installing Composer I've just changed the namespace in composer.json
and then did composer dump autoload
in the terminal; is there anything else I have to change?
As to your question, I haven't downloaded the latest version of AWPS because I've customized it quite a bit (e.g. I'm using Webpack instead of Gulp, I've created a custom Settings API class, etc.); but AWPS was invaluable for me to learn using Wordpress the OOP way, dependency managers, etc. so thank you so much for creating the theme and the tutorials you share on YouTube!