1

I know the benefits of creating child themes, but it in my case I really would like to create a theme based upon another one without any dependencies to a parent theme. I tried to use a sed command to replace all occurrances of 'Twenty Fourteen'/'Twenty_Fourteen'/ 'twentyfourteen' in all files, but that just doesn't seem to be enough, the theme gets broken.

Is there a way to do this?

Thank you.


Update - SOLUTION: Rename all instances of 'Twenty Fourteen', 'Twenty_Fourteen' and 'twentyfourteen' to your desired new theme name, watch out for case-sensitivity, it should work out. Use a code editor that can replace words in a directory, sed should also work if you know how to use it properly, unlike me.

6
  • 2
    Maybe it would be beneficial to create your own theme from scratch. Here are the basics and there are tons of tutorials online. View Codex
    – Howdy_McGee
    Commented Apr 17, 2014 at 18:42
  • Yep that's what I am aiming, but I would like to keep some stuff, e.g. the responsive navigation (hamburger menu for mobile), since I haven't found any better implementation that is freely available for reuse. I assume that the official WP theme's navigation works across all browsers and the tutorials I have seen on creating a responsive menu just don't seem to work out as nice as this. For the rest of the theme, I would like to write my own code, so I wanted to rename everything and then strip down to the navigation and start adding my own ideas. Commented Apr 17, 2014 at 18:47
  • It's not that I don't want to give credit to the original developers, but I don't want people to have to mess around with parent theme, child theme when they install it. Commented Apr 17, 2014 at 18:48
  • Then why not edit the theme directly? You don't necessarily NEED to create a child theme, though I'm not sure if there are any license issues with that, it's probably covered under GPL
    – Howdy_McGee
    Commented Apr 17, 2014 at 18:51
  • I think that the default themes are there to be used. These themes are coded to the standards that should be used. I would really think that these are excellent basis to work from when developing a theme. Why reinvent the wheel when it is already there Commented Apr 17, 2014 at 18:52

2 Answers 2

3

I think that the default themes are there to be used. These themes are coded to the standards that should be used and excellent example for new theme authors to learn from. They are also all under the GNU General Public License. I would really think that these are excellent basis to work from when developing a new theme. Why reinvent the wheel when it is already there

I have recently done the same exact thing. It is quite tricky, as it not just simply a mass search en replace operation. You have to methodically check and replace instances. The easiest way to start here is with the localized strings. Simply use a program like Notepad++ and replace 'twnentyfourteen' with 'my-theme'

The safest to go next is to take a string and replace twentyfourteen, like @since Twenty Fourteen 1.0 replace with @since My Theme 1.0.

You need to constantly check that you don't break anything. and if I can give you advice here, do one by one file, Notepad++ have a mass find and replace function. Don't use that. Take one file at a time and replace all instance of twentyfourteen, check and recheck and move to the next template. Grueling task, but worthwhile

3
  • :3 Notepad++ +1
    – Howdy_McGee
    Commented Apr 17, 2014 at 18:52
  • Thanks, I am trying another approach, I have stripped down Twenty Fourteen as much as (70 files --> 20 files) I could, and now I'm going to try replacing the theme's name. Commented Apr 17, 2014 at 19:00
  • I took Sublime and it did the job. The key thing with sed was I guess that I missed case-sensitivity. Even the ~20 files contained more than 400 occurrences of 'Twenty Fourteen', 'twentyfourteen' or 'Twenty_Fourteen'. Commented Apr 17, 2014 at 21:00
1

Just to add to the answer above, I agree 100% that those are a good basis, I try to use the yearly new theme every time, since all the new features will be implemented in it, and I can just pick what I leave out or not. Anyway, I've done this many many times and I believe it's not as painstaking as a task as Pieter suggests. You can get this done in 15min tops. What i usually do is search and replace "twentyfourteen" with "my_theme", that will take care of all the custom functions and text domain for localisation. You need to do it with solid reliable software of course, but unless I'm forgetting something, it wouldn't break anything. What you are left with are just the comments and you can either leave them as is and delete/edit them as you go (you're probably not gonna use all files anyway). Or you can take a while to edit them all (and Pieter's search and replace would be a good starting point).

The CSS is actually the biggest problem I think, since you're probably gonna change the layout and classes/id's + there's a lot of code in there that your particular project probably wouldn't need. I tend to keep the Reset, Images and sometimes Repeatable pattern sections and work from there. You can always go back to the default twenty fourteen css file if you're missing anything.

I also like to clean up the functions.php and only leave in the functions I'll need. I think the main thing is, just grab what you need. Start with index, style, functions, page, archive, etc... + the includes and all of that. I usually don't need the post formats and such, you can get rid of a lot of files and lines of code that way.

3
  • Thanks for your comment. I took sublime (I'm on Linux) and saved myself from the hassle of going through the files one by one. Commented Apr 17, 2014 at 20:57
  • 1
    I'm using Sublime too :-) Works great!
    – Pim
    Commented Apr 17, 2014 at 21:00
  • I guess that's the smartest code editor thing around available for Linux and doesn't come with a heavy-weight IDE, but still has a lot of auto-suggestions. Commented Apr 17, 2014 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.