修改WordPress主题

修改WordPress主题

这是一种修改文件后备份的文件(由子主题表示),而无需在修改WordPress主题时触摸原件。

  1. 要轻松查看使用的孩子主题,请在“ WP-Content/Theme”文件夹中创建一个新文件夹(例如,如果原始主题为“ TwyfiftEfte”,请创建一个带有“二十五个孩子”的文件夹)
  2. 将原始主题的“ style.css”复制到“子主题”文件夹,并修改“主题名称”和“ 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)

Leave a Reply

이메일 주소는 공개되지 않습니다. (* 질문, 건의사항 등은 "질문게시판"을 이용해주세요)