Home How to make sure my wordpress theme does not get broken when an update occurs on a parent theme
Reply: 3

How to make sure my wordpress theme does not get broken when an update occurs on a parent theme

Mizlul Published in 2018-01-12 22:44:30Z

I have created a child theme which uses sydney(parent) and created a separate folder for it. In order for me to customize the parent I need to re-write the css rules within style.css inside child theme, but I was wondering what if later parent theme get an update and looses all the classes and id which I am refering from my child style.css

    Theme Name: x
    Theme URL: www.x.com
    Description: X Theme
    Author: X
    Author URI: www.xyz.com
    Version: 1.0
    Template: sydney

.wp-custom-header .wp-custom-header-video-button {
    bottom: 50%;

.wp-custom-header .wp-custom-header-video-button {
    background-color: #ffffff;
    opacity: 0.5;

.wp-custom-header .wp-custom-header-video-button:hover {
    background-color: #ffffff;

.fa-pause {
    color: #065fe4;

    color: #065fe4;

#mainnav ul li a {
    font-size: 15px;
    font-weight: 900;
    font-style: normal;
    font-stretch: normal;
    line-height: normal;
    letter-spacing: normal;
    text-align: left;
    margin: 0 20px 0px 0px;

All above css classes and I am referring to the parent theme, bc all the header.php, content.php, page.php and others file exists there, Does that mean I should have my own version of all these pages? if So what's the use of creating a child theme, when I can create my own Parent theme, kinda confusing! What is the best way so that no matter the parent theme gets updated I would not want the child theme to get affected at any time!

Hoargarth Reply to 2018-01-12 22:56:55Z

You should create a "Child Theme" for your desired theme. This way you can change the stuff you want to overwrite and it won't get lost during updates from your parent theme.

This should help you https://codex.wordpress.org/Child_Themes

Edit: Sorry i missread your Post at first.

The advantage for Child Themes are:

  • You don't need to copy the whole theme again. Just take the files you need to change into the child theme and you are done. The rest will be used from your parent theme.

  • You still get the updates for your parent theme (and thus also for your child theme). Creating your own "copied" parent theme may stop updates, or even worse, updates still are functional but will overwrite your customizations.

So unless you won't create a complete new theme, you really should create a child theme. This way you also see exactly which files you have changed.

beohof Reply to 2018-01-12 22:51:27Z

The answer is simple and short - you can't. You have to test your child the once there is a new main theme realease.

Zerus Reply to 2018-01-12 22:51:40Z

Just do:

  1. put your CSS to a separate file.

  2. connect in your css file after the css of that theme.


<link href="parent-theme-css.css" rel="stylesheet" type="text/css">
<link href="your-theme-css.css" rel="stylesheet" type="text/css">

No matter how parent-theme-css.css changes, your your-theme-css.css will rewrite it where needed.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.335199 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO