{"id":19172,"date":"2024-07-10T16:13:21","date_gmt":"2024-07-10T08:13:21","guid":{"rendered":"https:\/\/www.onlinestorebeginner.com\/?p=19172"},"modified":"2024-07-10T16:13:21","modified_gmt":"2024-07-10T08:13:21","slug":"create-a-child-theme-for-wordpress","status":"publish","type":"post","link":"https:\/\/www.qingsongb2c.com\/en\/create-a-child-theme-for-wordpress\/","title":{"rendered":"Why and How to Create a Child Theme for WordPress Website"},"content":{"rendered":"\n<p>A WordPress Child Theme is a theme that inherits the functionality and styles of another theme, known as the parent theme. The child theme separates the customizations from the core functionality of the parent theme while retaining all the features of the parent theme.<\/p>\n\n\n\n<p>Installing a child theme in WordPress has many benefits for both new and experienced WordPress users. This article will introduce the advantages of using a child theme and provide a guide on how to create a child theme on your WordPress website.<\/p>\n\n\n<style>.wp-block-kadence-advancedheading.kt-adv-heading21340_daafbf-2f, .wp-block-kadence-advancedheading.kt-adv-heading21340_daafbf-2f[data-kb-block=\"kb-adv-heading21340_daafbf-2f\"]{font-size:var(--global-kb-font-size-sm, 0.9rem);font-style:normal;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;}.wp-block-kadence-advancedheading.kt-adv-heading21340_daafbf-2f mark.kt-highlight, .wp-block-kadence-advancedheading.kt-adv-heading21340_daafbf-2f[data-kb-block=\"kb-adv-heading21340_daafbf-2f\"] mark.kt-highlight{font-style:normal;color:#f76a0c;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.wp-block-kadence-advancedheading.kt-adv-heading21340_daafbf-2f img.kb-inline-image, .wp-block-kadence-advancedheading.kt-adv-heading21340_daafbf-2f[data-kb-block=\"kb-adv-heading21340_daafbf-2f\"] img.kb-inline-image{width:150px;vertical-align:baseline;}<\/style>\n<p class=\"kt-adv-heading21340_daafbf-2f wp-block-kadence-advancedheading has-theme-palette-8-background-color has-background\" data-kb-block=\"kb-adv-heading21340_daafbf-2f\">\u273b\u00a0This page may contains external affiliate links that we might receive a commission if you choose to purchase mentioned product or service, without any extra cost to you. We only recommend products or services we believe will add value to the readers.<\/p>\n\n\n<style>.kadence-column21340_97b07e-b4 > .kt-inside-inner-col,.kadence-column21340_97b07e-b4 > .kt-inside-inner-col:before{border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px;}.kadence-column21340_97b07e-b4 > .kt-inside-inner-col{column-gap:var(--global-kb-gap-sm, 1rem);}.kadence-column21340_97b07e-b4 > .kt-inside-inner-col{flex-direction:column;}.kadence-column21340_97b07e-b4 > .kt-inside-inner-col > .aligncenter{width:100%;}.kadence-column21340_97b07e-b4 > .kt-inside-inner-col:before{opacity:0.3;}.kadence-column21340_97b07e-b4{position:relative;}@media all and (max-width: 1024px){.kadence-column21340_97b07e-b4 > .kt-inside-inner-col{flex-direction:column;justify-content:center;}}@media all and (max-width: 767px){.kadence-column21340_97b07e-b4 > .kt-inside-inner-col{flex-direction:column;justify-content:center;}}<\/style>\n<div class=\"wp-block-kadence-column kadence-column21340_97b07e-b4 kvs-lg-false\"><div class=\"kt-inside-inner-col\"><style>.kb-table-of-content-nav.kb-table-of-content-id21340_e78e52-71 .kb-table-of-content-wrap{padding-top:var(--global-kb-spacing-sm, 1.5rem);padding-right:var(--global-kb-spacing-sm, 1.5rem);padding-bottom:var(--global-kb-spacing-sm, 1.5rem);padding-left:var(--global-kb-spacing-sm, 1.5rem);border-top:1px solid #c2c2c2;border-right:1px solid #c2c2c2;border-bottom:1px solid #c2c2c2;border-left:1px solid #c2c2c2;border-top-left-radius:10px;border-top-right-radius:10px;border-bottom-right-radius:10px;border-bottom-left-radius:10px;}.kb-table-of-content-nav.kb-table-of-content-id21340_e78e52-71 .kb-table-of-contents-title-wrap{padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;border-bottom:1px solid rgba(45,55,72,0.3);}.kb-table-of-content-nav.kb-table-of-content-id21340_e78e52-71 .kb-table-of-contents-title{font-size:var(--global-kb-font-size-md, 1.25rem);font-family:var( --global-heading-font-family, inherit );font-weight:inherit;font-style:normal;}.kb-table-of-content-nav.kb-table-of-content-id21340_e78e52-71 .kb-table-of-content-wrap .kb-table-of-content-list{font-size:var(--global-kb-font-size-sm, 0.9rem);font-family:var( --global-body-font-family, inherit );font-weight:inherit;font-style:normal;margin-top:var(--global-kb-spacing-sm, 1.5rem);margin-right:0px;margin-bottom:0px;margin-left:0px;}.kb-table-of-content-nav.kb-table-of-content-id21340_e78e52-71 .kb-table-of-content-list li{margin-bottom:15px;}.kb-table-of-content-nav.kb-table-of-content-id21340_e78e52-71 .kb-table-of-content-list li .kb-table-of-contents-list-sub{margin-top:15px;}@media all and (max-width: 1024px){.kb-table-of-content-nav.kb-table-of-content-id21340_e78e52-71 .kb-table-of-content-wrap{border-top:1px solid #c2c2c2;border-right:1px solid #c2c2c2;border-bottom:1px solid #c2c2c2;border-left:1px solid #c2c2c2;}}@media all and (max-width: 1024px){.kb-table-of-content-nav.kb-table-of-content-id21340_e78e52-71 .kb-table-of-contents-title-wrap{border-bottom:1px solid rgba(45,55,72,0.3);}}@media all and (max-width: 767px){.kb-table-of-content-nav.kb-table-of-content-id21340_e78e52-71 .kb-table-of-content-wrap{border-top:1px solid #c2c2c2;border-right:1px solid #c2c2c2;border-bottom:1px solid #c2c2c2;border-left:1px solid #c2c2c2;}.kb-table-of-content-nav.kb-table-of-content-id21340_e78e52-71 .kb-table-of-contents-title-wrap{border-bottom:1px solid rgba(45,55,72,0.3);}}<\/style><\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Why Child Theme<\/h2>\n\n\n\n<p>First, let&#8217;s take a look at the file structure of a child theme. For example, let&#8217;s consider a theme called Twenty-twenty-Four.<\/p>\n\n\n\n<p><strong>Parent Theme:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-theme-palette-9-color has-theme-palette-3-background-color has-text-color has-background has-link-color wp-elements-96bdc9202b86b42c1bef55c07266a48e\"><code>twentytwenty-four\/\n\u251c\u2500\u2500 index.php\n\u251c\u2500\u2500 header.php\n\u251c\u2500\u2500 footer.php\n\u251c\u2500\u2500 style.css\n\u251c\u2500\u2500 functions.php\n\u2514\u2500\u2500 ...\uff08other tempaltes files\uff09<\/code><\/pre>\n\n\n\n<p><strong>Child Themes:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-theme-palette-9-color has-theme-palette-3-background-color has-text-color has-background has-link-color wp-elements-3d0ea26838d8ad0648b45c2386a11582\"><code>twentytwenty-four-child\/\n\u251c\u2500\u2500 style.css\n\u251c\u2500\u2500 functions.php\n\u2514\u2500\u2500 single.php\uff08cover parent theme's single.php\uff09\n<\/code><\/pre>\n\n\n\n<p>As mentioned earlier, a child theme primarily inherits the functionality and styles of the parent theme without affecting the core functions and code of the parent theme. It acts as an additional layer on top of the parent theme, ensuring that custom settings in the child theme remain unaffected when the parent theme is updated.<\/p>\n\n\n\n<p>So, the <strong>main advantages of using a child theme<\/strong> are:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Customization Security<\/strong>: As mentioned earlier, a child theme sits on top of the parent theme, ensuring that your custom styles and functions are not lost when the parent theme is updated.<\/li>\n\n\n\n<li><strong>Update Security<\/strong>: With a child theme, you can freely update the parent theme without worrying about overwriting your custom code. Parent theme updates often include security patches and new features, which are crucial for keeping your site secure and up-to-date.<\/li>\n\n\n\n<li><strong>Advantages for Developers<\/strong>:\n<ul class=\"wp-block-list\">\n<li>A child theme helps keep your code and file structure clear and organized, making it easier to maintain and manage.<\/li>\n\n\n\n<li>You can experiment and gradually learn how to modify and extend WordPress functionality without affecting the parent theme.<\/li>\n\n\n\n<li>Using a child theme is one of the best practices recommended by the WordPress community. It\u2019s not only a common practice among developers but also an effective way to improve workflow and reduce potential issues.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>For many beginners and regular users, it\u2019s simple: when you install a theme, you often need to make some settings. If you have a child theme, you won\u2019t have to worry about losing these settings when the theme is updated. This means you won\u2019t need to redo your settings.<\/p>\n\n\n\n<p>Typically, WordPress themes have various settings, including custom layout designs, styles, and possibly adding external verifications like Google Analytics codes or search engine verification codes.<\/p>\n\n\n\n<p>As for the advantages for developers, regular users don\u2019t need to worry too much about that.<\/p>\n\n\n\n<p>In short, using a child theme ensures that your theme settings are preserved, enhances <strong>update security<\/strong>, and doesn\u2019t add extra management work. This is beneficial for both novice and experienced users alike.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Install Child Theme Generate Plugin<\/h2>\n\n\n\n<p>If you are very familiar with the structure of WordPress themes, you can manually create a child theme. However, since this article is aimed at beginners and regular users, I recommend using a plugin to create a child theme as it is simpler and more convenient.<\/p>\n\n\n\n<p>Head over to the admin dashboard, go to Plugins -&gt; Add New, and search for &#8220;child theme&#8221;. You should find several related plugins available, such as the <a href=\"https:\/\/wordpress.org\/plugins\/wp-child-theme-generator\/\" target=\"_blank\" rel=\"noopener\">WP Child Theme Generator<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"427\" src=\"https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-51-1024x427.png\" alt=\"\" class=\"wp-image-19286\" title=\"\" srcset=\"https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-51-1024x427.png 1024w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-51-300x125.png 300w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-51-768x320.png 768w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-51-1536x641.png 1536w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-51.png 1827w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Click on &#8220;<strong>Install Now<\/strong>&#8220;, wait for the installation to complete, and then click &#8220;Activate&#8221;. Now you can use this plugin.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Create a Child Theme<\/h2>\n\n\n\n<p>Once the plugin is activated, you can find a menu item labeled &#8220;Child Theme Gen&#8221; under Appearance. Click on it to create a child theme.<\/p>\n\n\n\n<p>First, you need to select a theme, typically the one you are currently using. For example, if I&#8217;m using the Kadence theme, I would select that theme.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"614\" src=\"https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-52-1024x614.png\" alt=\"\" class=\"wp-image-19287\" title=\"\" srcset=\"https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-52-1024x614.png 1024w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-52-300x180.png 300w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-52-768x460.png 768w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-52.png 1520w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Next, the plugin will prompt you to set some parameters for the child theme. You have the freedom to customize these settings as you like, or you can choose to leave them as default and proceed to generate the child theme.<\/p>\n\n\n\n<p>For example, you can use a custom screenshot for the child theme:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"256\" src=\"https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-53-1024x256.png\" alt=\"\" class=\"wp-image-19288\" title=\"\" srcset=\"https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-53-1024x256.png 1024w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-53-300x75.png 300w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-53-768x192.png 768w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-53-1536x384.png 1536w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-53.png 1586w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>However, checking &#8220;Create &amp; Activate&#8221; is not recommended to prevent losing your settings. Once you&#8217;ve set everything up, simply click on &#8220;<strong>Create Child Theme<\/strong>&#8220;. The process of creating the child theme is very quick\u2014it happens in the blink of an eye.<\/p>\n\n\n\n<p>Now you can navigate to Appearance &gt; Themes to view the newly created child theme.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Activating and Using the Child Theme<\/h2>\n\n\n\n<p><strong>Before activating the child theme, please note<\/strong>: First, export your customized settings of the currently used theme. Go to Appearance -&gt; Customize. Scroll down to the bottom of the left-hand navigation and you&#8217;ll find an <strong>Import\/Export<\/strong> section. Click on it and then hit the Export button to save this exported file. <\/p>\n\n\n\n<p>After activating the child theme, you can import this file to retain your previous settings intact. It&#8217;s crucial to remember this step; otherwise, you may need to reconfigure some settings.<\/p>\n\n\n\n<p>If your theme doesn&#8217;t have a Customize option, you can skip this step.<\/p>\n\n\n\n<p>Some plugins create child themes without affecting your original settings, while others might. Performing this step ensures you&#8217;re covered just in case. This is why I advised against activating the child theme immediately after creation.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"333\" src=\"https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-54-1024x333.png\" alt=\"\" class=\"wp-image-19292\" title=\"\" srcset=\"https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-54-1024x333.png 1024w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-54-300x98.png 300w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-54-768x250.png 768w, https:\/\/www.qingsongb2c.com\/en\/wp-content\/uploads\/2024\/06\/image-54.png 1113w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Once everything is set up, hover over &#8220;Kadence Child&#8221; and click &#8220;<strong>Activate<\/strong>&#8220;. The theme will then be activated. From now on, when you update the Kadence theme, you won&#8217;t have to worry about losing settings that affect your website&#8217;s operation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>I&#8217;ve already mentioned a lot above, but for regular users, creating a child theme is about safeguarding against data and settings loss during theme updates. <a href=\"https:\/\/www.www.qingsongb2c.com\/en\/build-an-online-store-with-wordpress\/\" target=\"_blank\" rel=\"noreferrer noopener\">For Beginners building a website with WordPress<\/a>, creating a child theme is highly recommended.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A WordPress Child Theme is a theme that inherits the functionality and styles of another theme, known as the parent theme. The child theme separates the customizations from the core&#8230;<\/p>\n","protected":false},"author":1,"featured_media":19293,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[9,3,8],"tags":[74],"class_list":["post-19172","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-common-guides","category-guides","category-wordpress-and-woo-tutorials","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.qingsongb2c.com\/en\/wp-json\/wp\/v2\/posts\/19172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qingsongb2c.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qingsongb2c.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qingsongb2c.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qingsongb2c.com\/en\/wp-json\/wp\/v2\/comments?post=19172"}],"version-history":[{"count":0,"href":"https:\/\/www.qingsongb2c.com\/en\/wp-json\/wp\/v2\/posts\/19172\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.qingsongb2c.com\/en\/wp-json\/wp\/v2\/media\/19293"}],"wp:attachment":[{"href":"https:\/\/www.qingsongb2c.com\/en\/wp-json\/wp\/v2\/media?parent=19172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qingsongb2c.com\/en\/wp-json\/wp\/v2\/categories?post=19172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qingsongb2c.com\/en\/wp-json\/wp\/v2\/tags?post=19172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}