Themes

While WordPress is set up to make it easy to switch from one theme to another, I soon learned that sometimes things get lost or hidden in the process.

For example, I started an ecommerce store, using the theme “Emmet” and the Woocommerce plugins (Woocommerce, Woocommerce Customizer, and Woocommerce Paypal Powered by Braintree). Because Emmet displayed information on the home page that was mysteriously populated and couldn’t be edited in HTML (as far as I could discover), I switched to Storefront. However, the way Emmet had stored some of the information did not match what Storefront was accessing. As a result, that information was in the database but not displayed.

To resolve the problem, I re-installed the “Emmet Theme Engine” (not the theme) and it allowed the hidden information to be displayed. If I were to do over, I would go straight to the Storefront theme and minimize the complications.

The lesson for me: before adding much content, play around with several themes so that when you choose one, you are satisfied and do not risk having to work around disconnects between themes.

Child Themes

For many customizations, the file “functions.php” requires additions or deletions. Each WP theme has this file. However, if you modify the file (or the style.css), the modified file will eventually be overwritten by a theme update. The customizations will vanish. As a result, the best practice is to create a child theme. The Internet has many tutorials for doing this, and once you’ve done it successfully, it is easy to do again. All of my WP sites now have child themes.

A child theme minimally consists of a folder, “Themename-child”, a functions.php, and a style.css file. The child theme is where customizations are stored, and the child theme references the parent theme (where the rest of the code is stored). It’s an elegant solution.

If you don’t or can’t create directories and add files to your WP site, there are plugins that create child themes. One current plugin describes its function thus: “Create child themes with the click of a button.” If you use such a solution, you can then edit the child files via Dashboard > Appearance > Editor. You will be warned to be careful at this point, but the warning assumes you are editing a parent theme, not a child theme.

If you prefer to manage the child theme manually, you might try searching on the name of your theme + “child”; in the results, you may find that either the theme creator or someone else has already provided free files that comprise the child theme. Or you can create the files yourself using a tutorial such as this from the WordPress Codex.

Child Theme Complications

Following are two things that caused me some difficulty and may be avoided by you.

First, I use custom CSS in all my sites. I initially added this CSS information under the Appearance > Customize > Additional CSS menu from the dashboard. Because—after creating a child theme—I now had a child “style.css” file that I could edit, I decided to move all the custom CSS into the child style.css.

Initially, it appeared that I was getting mixed results from moving the additional css into the child style.css. It turns out that my browsers cached the older versions of my style.css. In the end, I edited in Safari and viewed my pages in Firefox, clearing everthing from the history each test. Without a problem, the child theme’s style.css handled all the custom css I use.

On a practical level, though, the difference between storing the custom css in Additional CSS and the child styles.css seems nominal.

Second, after you get your child theme in place and working, expect your site to look (temporarily) wrong. The reason is because some things have to be manually set in your child theme. These are also accessed through the dashboard (now the dashboard of the child theme) through Appearance > Customize. Primarily the Colors and the Header Image have to be set there. You may find yourself getting very good at switching back and forth between the parent theme and the child theme until you’ve recreated the original settings.

The best use to which I put my child themes is the addition of an Archive page that suits me more than the archive Widgets available. Moreover, I know that any time I want to edit functions.php, I can do so without the threat of the edits being overwritten with a theme update.

Leave a Reply

http-www-in1accord-net-wp