Before you ask please READ THIS

Update

edited December 2011 in Airlock Posts: 7
What is the best way to update the theme whithout losing any settings?

Comments

  • Posts: 7
    Does Airlock support child theme?
  • AirAir
    Posts: 10,970
    For sure not fully. Not tested, maybe extending Apollo13 class will do most of work.
  • edited December 2011 Posts: 4
    I have a bit to contribute to this @Apollo13_coder. Can you put $apollo13->start() inside of an init function and use add_action('init', 'function_name') instead of calling it directly? This would make overriding the class without changing the file easier.

    For now, I have added my own actions in a child theme to include my own CSS file.

    I could change the theme to show you what I mean and generate a patch if you'd like.

    Also, though, avoid private properties and methods in the class so it's easier to override...unless you're really sure :)

    Hope this helps...let me know if I can explain anything better.
    Post edited by waptech on
  • AirAir
    Posts: 10,970
    Hi waptech.

    Thanks for tips. There is only one private property and for sure it should be this way:-)
    So first change will really make theme more compatible with child themes? I must test it someday.

    Thanks for your time in that matter.

    With regards.
  • Yeah, it'll totally help because WordPress runs the parent theme's functions.php first, meaning that a child theme might as well not even extend the Apollo13 class - Apollo13::start will always have already been called!

    This way, the child theme can remove your init action and add its own if needed, potentially instantiating a subclass instead.

    Thanks for replying!
  • AirAir
    Posts: 10,970
    Ooo yes I know that, but now that you putted it this way it make really nice sense in term of usability :-)

    Thanks, I will check that for sure :-)
  • AirAir
    Posts: 10,970
    Init action is not good for this thing, as it mess things. Instead of it I have used construction from wordpress codex:
    $apollo13 = new Apollo13();
    if(!function_exists('lets_play_apollo_game')) {
    function lets_play_apollo_game(){
    global $apollo13;
    $apollo13->start();
    }
    }

    lets_play_apollo_game();
    Thanks for pointing this out!
  • Hmm...but won't that still do the same thing? How will that let child themes intercept Apollo13::start? One would still have to edit the parent's functions.php because the parent's functions.php is run first (or am I wrong?).

    I'd be interested (for my own purposes as well) what page on the codex you referenced.

    Thanks so much for your responsiveness..
  • AirAir
    Posts: 10,970
    http://codex.wordpress.org/Child_Themes#Using_functions.php

    Define function lets_play_apollo_game in fucntions.php in child theme, and in parent it wont run.
  • Ah, I see. I didn't know the child's functions.php was loaded first! Quite clever. Thanks.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!