{"id":4504,"date":"2021-06-21T04:21:11","date_gmt":"2021-06-21T04:21:11","guid":{"rendered":"https:\/\/studysection.com\/blog\/?p=4504"},"modified":"2021-06-21T05:15:19","modified_gmt":"2021-06-21T05:15:19","slug":"child-theme-in-wordpress","status":"publish","type":"post","link":"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/","title":{"rendered":"Child Theme In WordPress"},"content":{"rendered":"<p>A WordPress theme changes the look of your website. When building or choosing a theme, you have got many options to select from. For example, the theme can have a one, two, or more column layout. It can identify which devices or user actions make content visible. It can have custom typography and design elements. WordPress theme can display content, including images and videos, anywhere you would like.<\/p>\n<p>To understand why that\u2019s imperative, it\u2019s important to first understand the link between parent and child themes.<\/p>\n<p><strong>Parent Theme:<\/strong> The parent theme is an original complete theme. It includes the WordPress template files and assets mandatory for the theme. The index.php and the style.css files (the main template and style files) are the only required template files but most of the themes also include PHP files, localization files, graphics, Javascript, and\/or text files. All themes are considered parent themes apart from child themes. Let\u2019s take a look at what a child theme is and the benefits it offers site owners below.<\/p>\n<p><strong>Child Theme:<\/strong> As described in the overview, a child theme takes over the look and feel of the parent theme and all of its functions, but we can use it to make modifications wherever you want in the theme. In this way, customizations are different from the parent theme\u2019s files. In other words \u201cA child theme allows you to modify small aspects of your site\u2019s appearance yet still maintain your theme\u2019s look and functionality\u201d.  Using a child theme permits you to upgrade the parent theme without influencing the customizations you have made to your site.<\/p>\n<h2>Benefits of Creating a Child Theme<\/h2>\n<ul>\n<li>Most importantly, creating a child theme permits you to upgrade the parent theme without losing your customizations in WordPress. Without a child theme, you need to edit your theme files directly and any time you upgrade the theme, your modifications would be lost. As a result, you would be faced with an impossible choice, either don\u2019t keep your theme up to far, which could be a high-security risk or lose your customizations and the time you invested in creating them.<\/li>\n<li>It also enables you to start learning about and <a href=\"https:\/\/studysection.com\/blog\/debugging-in-javascript\/\">debugging<\/a> theme development in a low-risk environment. If you start to customize your child theme and something goes wrong or you are not satisfied, you can just disable the child theme. This will restore the parent theme and your website as it has been working since its inception.<\/li>\n<li>It is not always recommended by scholars to create a child theme, however. If you\u2019re frequently adding custom CSS, then creating a child theme is good. But if you\u2019re making extensive customizations to the theme\u2019s functionality, then it\u2019s better to creating a parent theme or selecting an option that has an existing child theme that you can then edit immediately.<\/li>\n<\/ul>\n<p>Now that we understand child themes and the benefits of using a Child Theme, Now we are going to discuss steps to create a child theme.<\/p>\n<h3>Steps To Create Child Theme:<\/h3>\n<ul>\n<li>First You need to create a child theme folder. We need to name this folder using the parent theme\u2019s name and add \u201c-child\u201d to the end. For Example, we created a child theme of Twenty Twenty-One, Then the name of the folder is \u201c<strong>twentytwentyone-child<\/strong>\u201d. This is the directory for our child theme. Here is the directory location where we need to create the child folder \u201c<strong>\/wp-content\/themes\/<\/strong>\u201d.<\/li>\n<li>After creating the child theme folder we need to create a \u201cStylesheet\u201d. This Stylesheet file will contain all of the CSS rules and declarations of the child theme and we name it \u201c<strong>style.css<\/strong>\u201d. After that, we need to add some required header comments. This comment will let us know that it is a child theme of the parent theme. Here is an example that you need to add.<\/li>\n<\/ul>\n<p><code>\/*<br \/>\n Theme Name:   Twenty Twenty-one<br \/>\n Theme URI:\thttp:\/\/example.com\/twenty-twenty-one-child\/<br \/>\n Description:  Twenty Twenty-one Child Theme<br \/>\n Author:   \tJohn Doe<br \/>\n Author URI:   http:\/\/example.com<br \/>\n Template: \ttwentytwentyone<br \/>\n Version:  \t1.0.0<br \/>\n License:  \tGNU General Public License v2 or later<br \/>\n License URI:  http:\/\/www.gnu.org\/licenses\/gpl-2.0.html<br \/>\n Tags:     \tlight, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready<br \/>\n Text Domain:  twentytwentyonechild<br \/>\n*\/<\/code><\/p>\n<p>From the above-mentioned comment two things are required: <\/p>\n<p><strong>Theme Name<\/strong> \u2013 It needs to be unique to our theme.<br \/>\n<strong>Template <\/strong>\u2013This is the name of the parent theme directory. The parent theme in our example is the Twenty Twenty-one theme, so the Template will be twentytwentyone.<\/p>\n<ul>\n<li>Now We need to create the <strong>Function<\/strong> file where we need to Enqueue the parent and child themes\u2019 stylesheets. So we need to create a file and name it \u201c<strong>function.php<\/strong>\u201d and add the following code to the file.<br \/>\n<code>&lt;?php<br \/>\nadd_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );<br \/>\nfunction enqueue_parent_styles() {<br \/>\n     wp_enqueue_style( 'parent-style', get_template_directory_uri().'\/style.css' );<br \/>\n}<br \/>\n?><\/code><br \/>\nThe above code will work. That way, once you add custom CSS and otherwise change your child theme, these modifications will replace certain styles and functions of the parent theme.\n<\/li>\n<li>Now it\u2019s time to install and activate the theme. You can do this in two ways First you can upload it From FTP and install it from Admin. Another way is you can perform both actions from our WordPress dashboard. We need to click on <strong>Appearance > Themes > Upload<\/strong>. Then, choose the child theme directory and then click on <strong>Activate<\/strong>.<\/li>\n<li>That\u2019s it you have activated your child theme now you can do any customizations to your child theme. Like you can start by adding CSS to the style.css file in the child theme. To change the functionality of the parent theme, you need to add functions to the functions.php file in your child theme\u2019s directory.<\/li>\n<\/ul>\n<p><small><em>jQuery presents a tree-like structure of all the elements on a webpage simplifying the syntax and further manipulating such elements. The <a href=\"https:\/\/www.studysection.com\/jquery-3.x-advanced\">jQuery Certification exam<\/a> by StudySection will secure your fundamental knowledge and a basic understanding of jQuery as an asset to improve your skills.<\/em><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A WordPress theme changes the look of your website. When building or choosing a theme, you have got many options<\/p>\n","protected":false},"author":1,"featured_media":4506,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[366,136],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Child Theme In WordPress Themes - StudySection Blog<\/title>\n<meta name=\"description\" content=\"A WordPress theme changes the look of your website. When building or choosing a theme, you have got many options to select from.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Child Theme In WordPress Themes - StudySection Blog\" \/>\n<meta property=\"og:description\" content=\"A WordPress theme changes the look of your website. When building or choosing a theme, you have got many options to select from.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog Posts on famous people, innovations and educational topics\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/studysection\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-21T04:21:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-21T05:15:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/06\/wordpress-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin-studysection-blog\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@studysection\" \/>\n<meta name=\"twitter:site\" content=\"@studysection\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin-studysection-blog\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/\"},\"author\":{\"name\":\"admin-studysection-blog\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\"},\"headline\":\"Child Theme In WordPress\",\"datePublished\":\"2021-06-21T04:21:11+00:00\",\"dateModified\":\"2021-06-21T05:15:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/\"},\"wordCount\":930,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"keywords\":[\"theme\",\"wordpress\"],\"articleSection\":[\"Learn and Grow\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/\",\"url\":\"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/\",\"name\":\"Child Theme In WordPress Themes - StudySection Blog\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/#website\"},\"datePublished\":\"2021-06-21T04:21:11+00:00\",\"dateModified\":\"2021-06-21T05:15:19+00:00\",\"description\":\"A WordPress theme changes the look of your website. When building or choosing a theme, you have got many options to select from.\",\"breadcrumb\":{\"@id\":\"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/studysection.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Child Theme In WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/studysection.com\/blog\/#website\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"name\":\"Blog Posts on famous people, innovations and educational topics\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/studysection.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/studysection.com\/blog\/#organization\",\"name\":\"StudySection\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"contentUrl\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"width\":920,\"height\":440,\"caption\":\"StudySection\"},\"image\":{\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/studysection\",\"https:\/\/twitter.com\/studysection\",\"https:\/\/www.instagram.com\/study.section\/\",\"https:\/\/www.linkedin.com\/company\/studysection\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\",\"name\":\"admin-studysection-blog\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"caption\":\"admin-studysection-blog\"},\"url\":\"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Child Theme In WordPress Themes - StudySection Blog","description":"A WordPress theme changes the look of your website. When building or choosing a theme, you have got many options to select from.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/","og_locale":"en_US","og_type":"article","og_title":"Child Theme In WordPress Themes - StudySection Blog","og_description":"A WordPress theme changes the look of your website. When building or choosing a theme, you have got many options to select from.","og_url":"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/","og_site_name":"Blog Posts on famous people, innovations and educational topics","article_publisher":"https:\/\/www.facebook.com\/studysection","article_published_time":"2021-06-21T04:21:11+00:00","article_modified_time":"2021-06-21T05:15:19+00:00","og_image":[{"width":300,"height":200,"url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/06\/wordpress-1.png","type":"image\/png"}],"author":"admin-studysection-blog","twitter_card":"summary_large_image","twitter_creator":"@studysection","twitter_site":"@studysection","twitter_misc":{"Written by":"admin-studysection-blog","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/#article","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/"},"author":{"name":"admin-studysection-blog","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402"},"headline":"Child Theme In WordPress","datePublished":"2021-06-21T04:21:11+00:00","dateModified":"2021-06-21T05:15:19+00:00","mainEntityOfPage":{"@id":"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/"},"wordCount":930,"commentCount":0,"publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"keywords":["theme","wordpress"],"articleSection":["Learn and Grow"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/","url":"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/","name":"Child Theme In WordPress Themes - StudySection Blog","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/#website"},"datePublished":"2021-06-21T04:21:11+00:00","dateModified":"2021-06-21T05:15:19+00:00","description":"A WordPress theme changes the look of your website. When building or choosing a theme, you have got many options to select from.","breadcrumb":{"@id":"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/studysection.com\/blog\/child-theme-in-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/studysection.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Child Theme In WordPress"}]},{"@type":"WebSite","@id":"https:\/\/studysection.com\/blog\/#website","url":"https:\/\/studysection.com\/blog\/","name":"Blog Posts on famous people, innovations and educational topics","description":"","publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/studysection.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/studysection.com\/blog\/#organization","name":"StudySection","url":"https:\/\/studysection.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","contentUrl":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","width":920,"height":440,"caption":"StudySection"},"image":{"@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/studysection","https:\/\/twitter.com\/studysection","https:\/\/www.instagram.com\/study.section\/","https:\/\/www.linkedin.com\/company\/studysection"]},{"@type":"Person","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402","name":"admin-studysection-blog","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","caption":"admin-studysection-blog"},"url":"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/"}]}},"views":178,"_links":{"self":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/4504"}],"collection":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/comments?post=4504"}],"version-history":[{"count":4,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/4504\/revisions"}],"predecessor-version":[{"id":4509,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/4504\/revisions\/4509"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media\/4506"}],"wp:attachment":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media?parent=4504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/categories?post=4504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/tags?post=4504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}