워드프레스 테마 수정하기

워드프레스 테마 수정하기

워드프레스 테마 수정시 원본을 건드리지 않고 백업(자식 테마로 표현) 된 파일을 수정하여 사용하는 방법입니다.

  1. 사용하는 자식 테마를 쉽게 확인하기 위해 테마의 이름을 조합하여 “wp-content/themes” 폴더에 새 폴더를 생성합니다.(예: 원본 테마가 “twentyfifteen” 라면 “twentyfifteen-child” 으로 폴더를 생성)
  2. 원본 테마의 “style.css” 를 자식 테마 폴더에 복사하고 “Theme Name”, “Themplate” 을 아래와 같이 수정합니다.
    /*
    Theme Name: Twenty Fifteen Child
    Theme URI: https://wordpress.org/themes/twentyfifteen/
    Template: twentyfifteen
    Author: the WordPress team
    Author URI: https://wordpress.org/
    Description: Our 2015 default theme is clean, blog-focused, and designed for clarity. Twenty Fifteen's simple, straightforward typography is readable on a wide variety of screen sizes, and suitable for multiple languages. We designed it using a mobile-first approach, meaning your content takes center-stage, regardless of whether your visitors arrive by smartphone, tablet, laptop, or desktop computer.
    Version: 1.5
    License: GNU General Public License v2 or later
    License URI: http://www.gnu.org/licenses/gpl-2.0.html
    Tags: black, blue, gray, pink, purple, white, yellow, dark, light, two-columns, left-sidebar, fixed-layout, responsive-layout, accessibility-ready, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, translation-ready
    Text Domain: twentyfifteenTemplate: twntyfifteen
    This theme, like WordPress, is licensed under the GPL.
    Use it to make something cool, have fun, and share what you've learned with others.
    */
    
  3. 자식 테마 폴더에 “functions.php” 를 아래 소스로 만듭니다.
    <?php
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    }
    ?>
    
  4. 원본 테마의 “screenshot.png” 을 자식 테마 폴더에 복사합니다.
  5. 수정할 원본 테마의 파일을 자식 테마 폴더에 복사 후 수정해서 사용하시면 됩니다.

(참고 : http://codex.wordpress.org/Child_Themes)

guest
0 Comments
Inline Feedbacks
View all comments