Editing a WordPress Theme
This is a method for editing WordPress themes by modifying backup files (referred to as child themes) without touching the original.
- To easily identify the child theme in use, create a new folder in the “wp-content/themes” directory by combining the theme names. (For example, if the original theme is “twentyfifteen”, create a folder named “twentyfifteen-child”)
- Copy the original theme’s “style.css” into the child theme folder and modify the “Theme Name” and “Template” as follows:
/* 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. */
- Create a “functions.php” file in the child theme folder using the code below.
<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); } ?> - Copy the original theme’s “screenshot.png” into the child theme folder.
- After copying the files from the original theme to the child theme folder, you can modify and use them as needed.
(Note: http://codex.wordpress.org/Child_Themes)











Leave a Reply