Updating child theme after upgrade to 1.1

ForumCategory: TechnicalUpdating child theme after upgrade to 1.1
JimGasperini asked 6 months ago

The “Version 1.1 Changes” page says in part:
“Created a child theme. Remember that if only want to change CSS styles, there’s no need to use a child theme; just use the Add CSS option in the Customizer (if you have JetPack turned on). Use this child theme if you want to make functionality changes.
Note: Folks already using a child theme will likely need to update their enqueue functions.”

Where is the newly created child theme? It did not appear in the list of themes when I upgraded to 1.1. Assuming I can find it somewhere, are there any advantage to using this new child theme? Should I start over with a new child theme? If I can still use my old child theme, I will need to figure out how to update its “enqueue functions.” Any pointers would be appreciated.

dgranja replied 6 months ago

That appears to be miscommunication, there is no child theme that comes with the UUA theme. Here’s the story for those less familiar with how this works – If you are going to customize ANYTHING that is in the theme folder (public_html/wp-content/themes/uua-congregation), then it’s better to generate a child theme and modify that instead. If you’re wise enough to live with the theme as is, then you can live a happy and fulfilling life without a child theme.
When you create a child theme, it will show up as an additional, separate theme under the Appearance > Themes dashboard menu. At the file system level, a child theme is another folder under the WordPress /themes folder at a parallel level with any other theme folders. However, it is actively linked to and inherits its settings from the parent theme. If you make changes or additions to the child theme, those will override the equivalent settings from the parent theme. Let’s say you create a file named the same as one in the parent theme; WordPress would use your child theme file instead of the parent theme file. Then if you deleted that file from the child theme, WordPress will revert to using the one still in the parent them. If the parent theme is updated by UUA, the update will only overwrite the files in the original parent theme folder – your customizations in the child theme folder will still be there untouched and will still override the equivalent settings in the parent theme. The child theme settings are “enqueued”, meaning they’re in line (or “in the queue” if you will) with other WordPress functionality, but the child customizations get to be a higher priority than the parent theme’s settings.
Most of the time the customizations people make to themes are changes to the css styles. If you’re a coder then you can also add functions to the site theme, but that’s less common. I have a child theme just because sometimes I tinker and don’t want to accidentally hose my site and have to restore a backup. Per recommended practice, I called my child theme “uua-congregation-child”. However, to be honest, I haven’t actually kept any site modifications. It’s still vanilla UUA Theme.
There are plugins that will create a child theme- however I tried one and it was incomplete and used some techniques that are no longer recommended. Like the UUA documentations says, see https://codex.wordpress.org/Child_Themes for the basics about creating a child theme. Its also has the basics about setting up the enqueue functions.
One thing I would advise if you decide to go the child theme route: create the child theme and point to it as an immediate step when first installing the uuacongregation them. Otherwise, when you switch to the child theme you will have to recreate a number of your site settings. You won’t lose your content, but you’ll lose some of what you setup such as your site logo, etc.
Hope that helps.

JimGasperini replied 6 months ago

Thanks for this detailed response, which I hope will be of use to others reading this thread.

As I thought I had made clear, however, our site has usedva child theme since the first version of the UUA theme launched. I use it for various modifications using php, not just css.

Thanks for clearing up the reference in “Version 1.1 Changes” that seemed to suggest that a child theme would somehow be part of the update installation.

What continues to be an obstacle is that UUA Theme apparently uses an idiosyncratic way of enqueuing. For example, following the WordPress codex, I read:

…where parent-style is the same $handle used in the parent theme when it registers its stylesheet. For example, if the parent theme is twentyfifteen, by looking in its functions.php for its wp_enqueue_style() call, you can see the tag it uses there is ‘twentyfifteen-style’. In your child code, replace the instance of ‘parent-style’ with…

Looking in the functions.php file for the uua-congregation theme, I do NOT see any “wp_enqueue_style() call”.

The last time I figured out enqueuing, two years ago, I used code helpfully supplied by another visitor to this forum, in this thread:

In this thread, people who punch above my pay grade on coding issues make comments like “the stylesheet for this theme is not in the default place” and “using the WordPress codex code for [this theme] doesn’t work at all.”

The enqueuing code I found there worked until today, when I embarked on the upgrade odyssey.

For those of us who use child themes beyond what could be handled by simple css, but who are not professional coders, it would be useful to have a clear walkthrough of how to enqueue stylesheets (and whatever else might need enqueuing) in a way that works for *this theme.*

2 Answers
dgranja answered 6 months ago

I realized I posted my first answer as a “Comment”, and this might be really useful information, so I’m going to post it as an answer:
What do we mean by “customize” the theme?  In reference to child themes, it means we directly and intentionally use a text editor to open and edit any files in this folder on the server running WordPress: /public_html/wp-content/themes/uua-congregation.
Unless you have added some special plugin, the only way to edit files from with the WordPress dashboard is from menu items Plugins > Editor. The Editor is truly the fruit of the tree of evil, so your life is better off without it. Regardless, that editor can only access plugin files, which are in a different location on the file system than the theme files. (But you still should leave it alone.)
In other words, it’s highly unlikely you will intentionally ‘customize’ your theme in a way that matters as far as requiring you to have a child theme. The “customizations” you make by adjusting settings from within the WordPress Dashboard GUI are zero concern in this regard.

JimGasperini answered 6 months ago

I was able to solve my child theme issues by starting over with a new child theme sent by Christopher through Facebook Messenger. Anyone encountering difficulties similar to mine, FYI.

dgranja replied 6 months ago

Any possibility of having that publicly available?

JimGasperini replied 6 months ago

How that is made available and to whom is up to Christopher, or those now managing the theme.

Margy Levine Young Staff replied 6 months ago

You bet! Here’s a link to a starter child theme for version 1.1: