WordPress.org

Ready to get started?Download WordPress

Forums

Customizr
[resolved] Downloadable Child theme? (22 posts)

  1. chappie
    Member
    Posted 8 months ago #

    Hi. First post and certain to make a fool of myself as I know so little. But somehow I have managed to get MAMP and WordPress and Customizr running on my Mac...and I love it. I have been reading this forum, the Snippets and the docs for over a week, saving copious clippings, like a squirrel, for possible future use. So a big thank you to nikeo and the regulars - including acub, electricfeed and rdellconsulting - for their tireless contributions.

    My first question only proves how scared I am to do stuff on my own. But wouldn't it be possible to make available for download a vanilla Customizr Child theme - presumably just a style.css - together with any other files, such as functions.php, which might be needed?

    I don't know if I'm suffering from information overload or paralysis by analysis but I have read both the WP child theme FAQ and nikeo's tutorial and don't know enough to understand either properly. I'm tempted to overwrite the Parent code, as and when needed, and simply deny myself future upgrades.

    I'm also thinking that maybe TextEdit on the Mac doesn't create plain text files...

    So many reasons to do nothing. But loving it.

  2. WPyogi
    Volunteer Moderator
    Posted 8 months ago #

    I'm tempted to overwrite the Parent code, as and when needed, and simply deny myself future upgrades.

    Not a good idea - your site will likely eventually be incompatible with WP.

    A child theme really isn't hard - just take it one step at a time. It involves skills that you really need anyway - so creating one is useful in that way too.

  3. Tasha
    Member
    Posted 8 months ago #

    Chappie, when I started I also thougth it was a little overwhelming, but I realised I was stressing for nothing. You probably have a bit of information overload and are now over-thinking things. If you mess it up you can just reinstall. You can do that a million times until you get it right. Maybe that will take the stress factor away?

    If you follow the tutorials step by step you will get it without a doubt. There are also loads of youtube videos that takes you through the process. Try follow one of them? Don't overwrite the Parent code! Can't stress that enough!!! Start with just the style.css, don't worry about functions.php for now. I use notepad++ which is a free editor you can download, try that.

    You could not be learning on a better theme. The author and contributors are amazing. Stick with it you will get it.

  4. chappie
    Member
    Posted 8 months ago #

    Thanks, guys. I do need to stop reading and start experimenting. I'll maybe bite the bullet tomorrow. So many more questions though...

    @Tasha: I don't think Notepad++ is cross-platform but I have downloaded TextWrangler which seems to do a similar job on Mac Os.

  5. WPyogi
    Volunteer Moderator
    Posted 8 months ago #

    Yep, TextWrangler is great!

  6. chappie
    Member
    Posted 8 months ago #

    Well, I snapped out of my analysis paralysis for long enough to create the child - and even my first custom functions.php. Father and child both doing well. I just need to remember to keep feeding it Snippets.

  7. Tasha
    Member
    Posted 8 months ago #

    :) Love it! I hope you blog? You seem to have a natural flair for it!

  8. chappie
    Member
    Posted 8 months ago #

    Ha! Thanks. No blog - but I do write for a living. (Not markup, obviously.) Maybe one day... when I make a website for myself.

  9. acub
    Member
    Posted 8 months ago #

    If you really want a downloadable child theme, i can create one for you in a matter of minutes. However, the steps are really few and it's best that you do them, so you overcome your fear of breaking the site.

    You only need 2 files: style.css and functions.php in your child theme. And of course, you need to put them in a folder. So...

    Step 1: Create the folder. It should be made in /wp-content/themes (just where Customizr is). Let's name the folder Awesomeness.
    Step 2: In your text editor of choice (TextWrangler sounds great) copy paste the code below and save it as style.css, in that folder. Make sure you save it with UTF-8 encoding (not ANSI or anything else):

    /*
    Theme Name:     Awesomeness
    Theme URI:      http://putyourownurl.here
    Description:    I made this
    Author:         Me, Myself
    Author URI:     http://putyourownurl.here
    Template:       customizr
    Version:        1.0.0
    */

    Step 3: Open a new text file and write <?php on first line and make sure it also has an empty second line. Save it as functions.php, also with UTF-8 encoding. When you will need to add functions to this file, always do it from second line below, not on first line. Right now your functions.php is considered empty, and it should look like this:

    <?php

    Needless to say, you need to upload the folder, with both files, on your server.

    Step 4: Activate your new child theme.

    And... you're done.
    Step 5. (Optional) If you want to get really fancy, you might want to take a snapshot of your first page, crop it in your picture editor of choice and save it as screenshot.png, in the same folder (most theme screenshots are 300 x 225px, but if yours is larger it will be scaled down when displayed). Now your theme also has a picture, like all the rest of the themes.

    From this moment on, if you can't resist the temptation of modifying a Customizr file, at least copy it (maintaining the folder structure) in your child theme. WordPress will only load the parent theme files if it doesn't find them in your active theme folder. That's all there is to it.

  10. chappie
    Member
    Posted 8 months ago #

    acub, you are very kind - and crystal clear (most folk who know a lot forget how little total novices know). In fact, I have already managed to create my child theme and all seems well -- although I see now that I made a mistake in not leaving an empty line after my php opening tag (didn't stop it working though).

    When I come to add some new code to this file (copied from Snippets) I presume I leave another empty line and paste away, without having to close the original opening tag or create another tag? I haven't used a closing tag.

    Incidentally, when I have pasted Snippets into my style.css I get a column of (line) numbers before the code, which I assume I should delete? Is there a way to copy Snippets without collecting the line numbers? And is there an easy way to copy long lines of code which disappear miles off the edge of my browser window? I have tried hitting Command-A (on my Mac) but it seems to select the whole page rather than just the box of code. Seems that it would be easier to include a blank line at the end if a final line of code is uber-wide so that I can at least be sure I have copied everything - but I would need to remember to delete the blank line at the end (or maybe it wouldn't matter).

    On one occasion today I was trying to add something new to both the CSS customiser and my functions.php but Customiz'It! wouldn't allow me to Save & Publish. What should that have been telling me?

    My site is hosted locally for now and I called it mysite.com. At what point - and where - do I need to give it its public name (eg. http://www.apples.com)?

    TextWrangler offers me two versions UTF-8 encoding - UTF-8 and UTF-8 BOM. I assume I don't want BOM? Is it true that I need to save - or send - my TextWrangler files straight to the server directory rather than saving to my hard drive first and uploading later?

    These are the very details which have frightened me off for a week so I'm sure your primer will be welcomed by other complete newbies too. And thanks to you, I now have a fancy picture of my child theme in my Dashboard!

  11. rdellconsulting
    Member
    Posted 8 months ago #

    To avoid the line numbers in the Snippets, click on the first button (4 horiz lines) before you cut & paste.

    If you click on the 4th button (2 'notes') then it will allow you to Ctrl/C or Cmd/C (cut) & Ctrl/V or Cmd/V (paste) easily.

  12. chappie
    Member
    Posted 8 months ago #

    Thanks Dave. Mea culpa for not even noticing those buttons (after staring at them for hours). They also resolve my long-lines query. Do I risk any problems by copying code which I have allowed to linewrap?

  13. rdellconsulting
    Member
    Posted 8 months ago #

    Not that I'm aware of

  14. acub
    Member
    Posted 8 months ago #

    Php recommends that php mode should not be exited before end of pure php files (the ones that are included or required by other php files, not the ones that are directly loaded by the browser and are actually replacing the .html counterpart of that file, but need to be parsed by php).
    As for coding standards, you should take a look at this.

    Ummm... yes, UTF-8 is the way to go.

    Moving a website from dev to public domain depends on a lot of details and variables. Most likely your website hosting company staff will be able to assist you with this task.

  15. chappie
    Member
    Posted 8 months ago #

    Thanks again, acub. I have been looking at some pretty neat plugins that claim to be able to upload, move and/or back up WP dev sites. Probably still fraught with danger in my hands - but at least I can keep a manual backup on my HD in case of disaster.

  16. acub
    Member
    Posted 8 months ago #

    I do not advise on using a plugin to go from dev to publish. It would have to be a very smart plugin not to mess things up.

    Here's how I do it:

    I install a clean WP to public, same version as the one I have on dev.
    I copy all wp-content from dev to public.
    I export the database from dev using adminer (you can also use phpmyadmin). I go to public, delete all tables from wordpress database and than import the data from dev. I than go in wp_options table and change the website's url (it's usually the first row). From that point on I'm able to log into public's WP and have exactly the same content as on dev.

    As for ftp tools, I used to be a fan of Cute FTP, but now I just use DreamWeaver's get and put commands.

  17. rdellconsulting
    Member
    Posted 8 months ago #

    I use a product called Desktop Server which allows me to have a local Dev environment before uploading to Test/Live environments. Depending upon your hosting company, it will automatically prepare your Dev environment and upload it to your server, both WP & Database.

    It's one of the best purchases (c£30) I ever made.

  18. chappie
    Member
    Posted 8 months ago #

    Thank you, Dave - and it's free for the first three sites, so that could last me a lifetime.

    I've had a quick read and it looks good - and your recommendations aren't given lightly. My main worry is that I apparently would have to delete my MAMP (which took a lot of blood, sweat and tears to install). What happens to my site when its oxygen is cut off? Presumably I move it to a folder on my hard drive and relocate it somewhere within Desktop Server's directories once I instal it?

    Please ignore if too off topic.

  19. nikeo
    Member
    Theme Author

    Posted 8 months ago #

    @acub i agree with @chappie : your explanations are crystal clear!

  20. chappie
    Member
    Posted 8 months ago #

    I'll try it your way, acub (when that day comes - it's some way off). I use Fetch on my Mac which I am at least reasonably familiar with.

    At what stage and how do I change my site name from its dev url of localhost:8888/sitename to livewebsite.com? Will one of your tools do it for me and resolve all my internal links?

  21. acub
    Member
    Posted 8 months ago #

    No, you do it manually, using phpMyAdmin (which normally is provided by your hosting provider, in cPanel). The url is in wp_options panel, first row. It's the only thing you need to manually change through phpmyadmin.
    For example, you don't need to change it manually if you use WordPress's import and export.

    Over the years i have moved a few websites from dev to public. I moved them in different ways, using various tools, WP export&import included. In some cases I had problems (with attachments, encoding, urls, permalinks...). All fixable, but they still needed further actions from me. The solution above is the one I used lately, as it's error free and doesn't take a lot of time. The worst thing that can happen is ftp transfer interruption.

  22. chappie
    Member
    Posted 8 months ago #

    Thank you and archived.

Reply

You must log in to post.

About this Theme

About this Topic