child themes code example

Example 1: create child theme wordpress

/*
 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:  twentyfifteenchild
*/

Example 2: how to add files in child theme in theme editor

add_action('after_setup_theme', function() {
	$file = get_stylesheet_directory() . '/my-file.php';
	touch($file);
});

Tags:

Php Example