Making life easier

One of the things I’ve been thinking about is how to make it easier to customize the theme in a child theme while still maintaining the ability to update Alien Ship with ease.

A common issue I see with themes is that if you want to make simple changes to a file (like header.php for example) you have to copy the file over, make your changes, and then when an update for the parent theme comes out you have to spend time merging those changes back into your child theme.

I hate having to maintain things like this, especially for small changes. So I’m looking at ways to change the structure of Alien Ship to make it easier for all of us. One way this can be handled is with template parts. For example, in the header.php file I broke out the meta data lines and put them into a file called inc/parts/meta.php. For someone who needs to make changes to this meta data, they can simply edit this one file instead of maintaining the whole header.php in their child theme. I did the same thing with the title, since this is something that people commonly want to change for SEO purposes.

There are other ways of achieving this. Instead of using template parts, these things can be handled with functions/hooks. Using this method, one just creates their own function and overrides the one in Alien Ship.

It’s helpful to get an outside perspective on things, so I’d like to hear your thoughts on this before I move forward making these changes. Please share your thoughts and ideas in the comments.

4 thoughts on “Making life easier

  1. Hi John,

    here are my thoughts on this: Generally, I like themes to be as clean as possible, with as few files as necessary and possible.
    While template parts give a lot flexibility, they make making changes a lot harder: It takes forever to find the right place and file. And without some knowledge about WordPress template development, one basically doesn’t even have a chance of finding the correct file.
    Hooks and filters suffer from the same problem: One needs to know how to use them. And (although they are actually quite efficiently, performance-wise) they add some overhead and need extra maintenance work.
    So, my personal preference (though I’m not really a theme developer) is a simple concept that allows me to make changes easily, and find the corresponding places easily. This does of course have the drawback that you mention initially (about merging changes), but I can live with that. (Mainly probably, because I have my WP installation under version control as well.)

    Best wishes,
    Tobias

  2. I’ve been working on a project lately and i found myself having to copy several files from Parent theme so as to achieve the results I wanted. I am not very keen on this method because, as you point out , you have to merge changes when Parent is improved/updated which being realistic most of the time you end-up not doing, so you loose all the goodness. I used to work with Thematic framework back in the old days, and what I loved about it is that you could make any possible change using actions and hooks (LOTS of them). I think it is a better way of doing things. True you have some learning curve but If the doc is consistent, I think it’s totally worth it. Maybe it’s just that I’m used to it.
    By the way I tried to contribute with some code that I think can be useful, so I posted to Github, but I’m not sure I did it correctly (first time I use it) because first I forked, and next I pulled a request ?. Have a look if you got five minutes.
    Thanks again for Alienship, I really enjoy working with it.

  3. Hey guys, thanks a lot for your feedback. I really appreciate you guys.

    This is something that I’ve been dealing with and thinking about as I use the theme as a starting point on other projects. I’ll continue to consider the possibilities and share my thoughts.

    Cestbibi, I haven’t yet checked out the pull request. I’ll take a look at it soon.

  4. Thank you John, never mind the pull request, I ‘ve just seen you’ve already implemented it in version 0.7 (it was some code to display the thumbnail when viewing posts in excerpt mode).
    I contributed with another bit code (featured/grid posts only displays in first page , but no subsequent ones) but for this I forked the whole project (but I think this is not necessary) . Please feel free to review the code, and don’t hesitate to delete the fork if needed.
    Could you advise on the better way to go if I want to contribute or sugest code for you ? I have no clue ;-)

Leave a Reply