Wordpress: Switching to Child-Theme
I had made a minor
tweak
to this site's .css
file, and today I decided to move that tweak into
a child-theme, so that it
would "stick" after updating the main theme.
The instructions boil down to:
- Create a folder
wp-content/themes/twentyeleven-child
on the server (I am using the twentyeleven theme) - Create a
style.css
file - Copy/paste the necessary css-lines from Wordpress, and modify the appropriate lines.
- Add custom css at the bottom of the file
- Switch to Child Theme in WordPress settings, under "Appearance -> Themes".
Problem: Now all my previous settings of the main theme (which I had made under "Appearance -> Customize" were gone! They weren't really gone though, they were just "unset". I had to go into "Appearance -> Customize" again and redo the following:
- Old header image is gone: Choose it again, it's still among the uploaded files
- Old menus are gone: Choose them again in the "Navigation" subpanel
- Header text was displayed: I had to unset this again
I'm sure there are good reasons why these settings don't automatically carry over to a child-theme. Still, it's a bit of a surprise to do this "super-easy-can't-break-anything" procedure and then have to wade through settings again...
For future reference, this is what my child-theme looks like: A single
style.css
file in a twentyeleven-child
folder:
/*
Theme Name: Twenty Eleven Child
Theme URI: http://hoeckerson.de/notes/
Description: Twenty Eleven Child Theme for minor tweaks
Author: Hoeckerson
Author URI: http://hoeckerson.de
Template: twentyeleven
Version: 1.0.0
Tags: tweaks
Text Domain: twenty-eleven-child
*/
@import url("../twentyeleven/style.css");
/* =Theme customization starts here
-------------------------------------------------------------- */
#lookmabezier {
width: 50px;
height: 50px;
margin: 50px; 50px;
background-color: #88F;
line-height: 50px;
text-align: center;
transition-property: transform;
transition-duration: 0.5s;
transition-timing-function: cubic-bezier(0.85, 0, 0.15, 1);
transition-delay: 0s;
}
#bezier-demo-container:hover #lookmabezier {
transform: translateX(200px);
transition-property: transform;
transition-duration: 0.5s;
transition-timing-function: cubic-bezier(0.85, 0, 0.15, 1);
transition-delay: 0s;
}