{"id":3319,"date":"2020-03-01T07:56:35","date_gmt":"2020-03-01T02:56:35","guid":{"rendered":"https:\/\/webplover.com\/hosting\/?p=3319"},"modified":"2022-02-12T13:33:00","modified_gmt":"2022-02-12T08:33:00","slug":"wordpress-child-theme","status":"publish","type":"post","link":"https:\/\/webplover.com\/hosting\/wordpress-child-theme\/","title":{"rendered":"What is WordPress Child Theme and How to Create it"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"what-is-child-theme\">What is Child Theme?<\/h2>\n\n\n\n<p>Child theme is a sub theme which needs a parent theme to work. Because a child theme inherits the parent theme&#8217;s look and functionality. A parent theme is a complete theme which consists all the required WordPress templates. All themes exclude child theme, considered parent theme.<\/p>\n\n\n\n<p>Usually a child theme needed two files <code>style.css<\/code> and <code>functions.php<\/code> to work properly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"benefits-of-the-child-theme\">Benefits of the Child Theme<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Speed up development :<\/strong> Using a child theme you can speed up your theme development, because you can use the parent theme templates in your child theme and also too much functions already defined in the parent theme, you can use them directly in your child theme. In other words, you will not need to create a new theme from scratch.<\/li><li><strong>Fallback option : <\/strong>By default WordPress checks the active theme templates first then checks the parent theme templates. So if you make a mistake in writing your child theme code, WordPress will automatically use your parent theme code without throwing an error.<\/li><li><strong>Not Losing Changes :<\/strong> if you make some changes and customization to your theme, after update your theme, all your customization and changes will be lost. In this case Child theme will help you to protect your customization.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-create-a-child-theme\">How to Create a Child Theme?<\/h2>\n\n\n\n<p>There are two ways to create Child Theme.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Manually<\/strong><\/li><li><strong>Using Plugin<\/strong><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"create-child-theme-manually\">Create Child Theme Manually<\/h2>\n\n\n\n<p>Before starting you&#8217;ll need the access to your file manager.<\/p>\n\n\n\n<p>You can achieve it by <strong>Cpanel <\/strong>\u00bb <strong>File Manage<\/strong>r or using <strong>FTP<\/strong><\/p>\n\n\n\n<p>Let&#8217;s Start<\/p>\n\n\n\n<p>In this example we will create a child theme of Astra theme, means Astra will our parent theme.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Note : The process will be same on all the WordPress themes.<\/p><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-1\">Step 1:<\/h3>\n\n\n\n<p>First of all create a new directory for your child theme in <code>wp-content\/themes<\/code> and name it which you want. I named it <strong>astra-chlid<\/strong> now my child theme path is <code>wp-content\/themes\/astra-child<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-2\">Step 2:<\/h3>\n\n\n\n<p>In this step we will create the two essential files in the child theme directory<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>style.css<\/strong><\/li><li><strong>functions.php<\/strong><\/li><\/ul>\n\n\n\n<p>To create <code>style.css<\/code> file, simply create new file and name it <code>style.css<\/code> then open it in your favorite Text Editor.<\/p>\n\n\n\n<p>Add the below code to it and save.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\nTheme Name: astra-child\nAuthor: Brainstorm Force\nAuthor URI: http:\/\/wpastra.com\/about\/\nDescription: Astra is fast, fully customizable &amp; beautiful theme.\nVersion: 1.0.0\nLicense: GNU General Public License v2 or later\nLicense URI: http:\/\/www.gnu.org\/licenses\/gpl-2.0.html\nText Domain: astra-child\nTemplate: astra\n*\/<\/code><\/pre>\n\n\n\n<p>Note : <code>template-name<\/code> is most important for <code>style.css<\/code> file if template name will not exist, child theme will not working.<\/p>\n\n\n\n<p>Now our <code>style.css<\/code> file is ready, let&#8217;s create <code>functions.php<\/code> file.<\/p>\n\n\n\n<p>Like <code>style.css<\/code> create a new file and name it <code>functions.php<\/code> and open it in text editor.<\/p>\n\n\n\n<p>Add the below code to it and save.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nadd_action( 'wp_enqueue_scripts', 'enqueue_child_stylesheet' );\nfunction enqueue_child_stylesheet() {\nwp_enqueue_style( 'child-stylesheet', get_stylesheet_uri() );\n}\n?><\/code><\/pre>\n\n\n\n<p>It will load the child style.css file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-3\">Step 3:<\/h3>\n\n\n\n<p>Your child theme is ready to use. Let&#8217;s activate it.<\/p>\n\n\n\n<p>Go to <strong>WordPress dashboard \u00bb Appearance \u00bb Themes<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>You will see your new child theme here, this time it has no image but you can add image to it easily by going to your parent theme directory and copy the screenshot.png then paste in child theme directory or you can make your own image of 1200 pixels wide and 900 pixels tall.<\/p><p>It&#8217;s important to name your picture <strong>screenshot.png<\/strong><\/p><\/blockquote>\n\n\n\n<p>Select the child theme and click on activate button.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"create-child-theme-using-plugin\">Create Child Theme Using Plugin<\/h2>\n\n\n\n<p>There are a Bunch of plugins which allows you to create child theme but i prefer to use <a href=\"https:\/\/wordpress.org\/plugins\/child-theme-configurator\/\" target=\"_blank\" rel=\"noopener noreferrer\">Child Theme Configurator<\/a> plugin due to its best and easy interface.<\/p>\n\n\n\n<p>Let&#8217;s create a child theme using <a href=\"https:\/\/wordpress.org\/plugins\/child-theme-configurator\/\" target=\"_blank\" rel=\"noopener noreferrer\">Child Theme Configurator<\/a> plugin.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-1\">Step 1:<\/h3>\n\n\n\n<p>Install <a href=\"https:\/\/wordpress.org\/plugins\/child-theme-configurator\/\" target=\"_blank\" rel=\"noopener noreferrer\">Child Theme Configurator<\/a> plugin. If you don&#8217;t know how to install a WordPress plugin, please read <a href=\"https:\/\/webplover.com\/hosting\/blog\/install-wordpress-plugin\" target=\"_blank\" rel=\"noopener noreferrer\">this article<\/a> it will guide you to install WordPress plugin.<\/p>\n\n\n\n<p>After install, activate it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-2\">Step 2:<\/h3>\n\n\n\n<p>Go to <strong>Tools \u00bb Child Themes<\/strong> and you will see a page like this<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><a href=\"https:\/\/webplover.com\/hosting\/wp-content\/uploads\/2020\/03\/wordpress-child-theme-configurator.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/webplover.com\/hosting\/wp-content\/uploads\/2020\/03\/wordpress-child-theme-configurator.jpg\" alt=\"wordpress-child-theme-configurator-plugin\" width=\"567\" height=\"229\"\/><\/a><\/figure>\n\n\n\n<p>Select <strong>CREATE a new Child Theme<\/strong> in <strong>Section 1<\/strong><\/p>\n\n\n\n<p><strong>Section 2<\/strong> will show you all your installed themes, select a parent theme for your child theme from drop down menu.<\/p>\n\n\n\n<p><strong>Section 3<\/strong> Click on <strong>Analyze<\/strong> button.<\/p>\n\n\n\n<p><strong>Section 4 <\/strong>Give a name to your child theme directory.<\/p>\n\n\n\n<p><strong>Section 5<\/strong> Select <strong>Primary Stylesheet (style.css)<\/strong><\/p>\n\n\n\n<p><strong>Section 6<\/strong> Select <strong>Use the WordPress style queue.<\/strong><\/p>\n\n\n\n<p><strong>Section 7<\/strong> Here you can customize the child theme Name, Description, Author and Version etc.<\/p>\n\n\n\n<p>By default this plugin will use the parent theme <em>Website address<\/em>, <em>Author name, Author website address, and Theme description<\/em> for the child theme.<\/p>\n\n\n\n<p><strong>Section 8 <\/strong>By checking in this section you can copy menus, widgets and other customizer settings from the parent theme to the child Theme.<\/p>\n\n\n\n<p><strong>Section 9<\/strong> Click on <em><strong>Create New Child Theme<\/strong><\/em> button.<\/p>\n\n\n\n<p>Done! Your child theme has been created.<\/p>\n\n\n\n<p>Now you can activate your child theme by going to <strong>Appearance \u00bb Themes<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-copy-files-from-parent-to-child-theme\">How to copy files from parent to child theme<\/h2>\n\n\n\n<p>You can copy files from parent theme to child by going to <strong>Tools \u00bb Child Themes \u00bb Files<\/strong><\/p>\n\n\n\n<p>Select files which you want to copy from parent to child theme and click on <strong>Copy Selected to Child Theme<\/strong> button.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"here-are-a-few-tutorials-for-you-to-read-next\">Here are a few tutorials for you to read next:<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/webplover.com\/hosting\/blog\/wordpress-functions-php\/\">What is functions.php in WordPress<\/a><\/li><li><a href=\"https:\/\/webplover.com\/hosting\/blog\/find-post-page-category-user-id-wordpress\/\">How to Find Post, Page, Category, or User ID in WordPress<\/a><\/li><li><a href=\"https:\/\/webplover.com\/hosting\/blog\/add-social-icons-to-wordpress-menu\/\">How To Add Social Media Icons To WordPress Menu<\/a><\/li><li><a href=\"https:\/\/webplover.com\/hosting\/blog\/display-wordpress-posts-in-grid-layout\/\">How to Display Your WordPress Posts in Grid Layout<\/a><\/li><li><a href=\"https:\/\/webplover.com\/hosting\/blog\/send-push-notifications-from-wordpress-site\/\">How to Send Push Notifications from WordPress Site [With Pictures]<\/a><\/li><\/ul>\n\n\n\n<div class=\"g-ytsubscribe\" data-channelid=\"UCArLhGLL14dgeiIKwlu4jYA\" data-layout=\"full\" data-count=\"hidden\">&nbsp;<\/div>\n\n\n\n<p><strong>If you find this tutorial helpful, then please Subscribe to our <\/strong><a href=\"https:\/\/m.youtube.com\/channel\/UCArLhGLL14dgeiIKwlu4jYA\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>YouTube Channel<\/strong><\/a><strong> for video tutorials, and share this article on social media.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Child Theme? Child theme is a sub theme which needs a parent theme to work. Because a child theme inherits the parent theme&#8217;s look and functionality. A parent theme is a complete theme which consists all the required WordPress templates. All themes exclude child theme, considered parent theme. Usually a child theme needed&#8230;<\/p>\n","protected":false},"author":220,"featured_media":4333,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"_kadence_starter_templates_imported_post":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":[228],"tags":[],"class_list":["post-3319","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"acf":[],"_links":{"self":[{"href":"https:\/\/webplover.com\/hosting\/wp-json\/wp\/v2\/posts\/3319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webplover.com\/hosting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webplover.com\/hosting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webplover.com\/hosting\/wp-json\/wp\/v2\/users\/220"}],"replies":[{"embeddable":true,"href":"https:\/\/webplover.com\/hosting\/wp-json\/wp\/v2\/comments?post=3319"}],"version-history":[{"count":0,"href":"https:\/\/webplover.com\/hosting\/wp-json\/wp\/v2\/posts\/3319\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webplover.com\/hosting\/wp-json\/wp\/v2\/media\/4333"}],"wp:attachment":[{"href":"https:\/\/webplover.com\/hosting\/wp-json\/wp\/v2\/media?parent=3319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webplover.com\/hosting\/wp-json\/wp\/v2\/categories?post=3319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webplover.com\/hosting\/wp-json\/wp\/v2\/tags?post=3319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}