Create a child theme for WordPress

Sometimes, you may want to modify a WordPress theme. The best practice for modifying a theme's style and functionality is through a child theme to prevent your changes from being lost when performing updates.

  1. Connect to your hosting with FTP
  2. Navigate to the wp-content/themes directory for your WordPress site.
  3. Create your child theme directory. The following is a common naming convention for child themes: <parent>-child, where <parent> is the name of your parent theme.
  4. Navigate into the child theme directory and create a style.css file.
  5. In the style.css file, add a stylesheet header, which contains metadata about your theme. The following is an example that you can use from a Twenty Fifteen child theme:
    /*
    Theme Name:   Twenty Fifteen Child
    Theme URI:    http://example.com/twenty-fifteen-child/
    Description:  Twenty Fifteen Child Theme
    Author:       John Doe
    Author URI:   http://example.com
    Template:     twentyfifteen
    Version:      1.0.0
    License:      GNU General Public License v2 or later
    License URI:  http://www.gnu.org/licenses/gpl-2.0.html
    Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
    Text Domain:  twenty-fifteen-child
    */

    Make sure to replace the information in the example with the information relative to your theme.

  6. Save the style.css file.
  7. Now create a functions.php file. This will contain PHP functions specific to your child theme.
  8. After creating the functions.php file, you will need to enqueue the styles and scripts from your parent theme into your child theme.
    • Open the functions.php file
    • Add a function that will be used to enqueue styles and scripts from your parent theme. Below is an example.
      <?php
      add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
          function my_theme_enqueue_styles() {
          wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
          }
      ?>
                      

Next steps


More info

More info about WPPS.

이 글이 도움되었나요?
피드백을 보내주셔서 감사합니다. 고객 서비스 담당자에게 문의하시려면 지원 전화 번호 또는 위의 채팅 옵션을 이용하시기 바랍니다.
도와드릴 수 있어 기쁩니다! 더 도와 드릴 것이 있나요?
그것 유감스럽습니다. 혼동이 되었던 사항 또는 솔루션이 고객님의 문제를 해결하지 못했던 원인을 알려주세요.