how to add files in child theme in theme editor
/*
Theme Name: WPB Child Theme
Theme URI: https://www.wpbeginner.com
Description: A Twenty Thirteen child theme
Author: WPBeginner
Author URI: https://www.wpbeginner.com
Template: twentythirteen
Version: 1.0.0
*/
@import url("../twentythirteen/style.css");
.site-title {
padding: 30px 0 30px;
}
.site-header .home-link {
min-height: 0px;
}
.navbar {
background-color: #e8e5ce;
}
.widget {
background-color: #e8e5ce;
}
.site-footer {
background-color: #d8cdc1;
}
.site-footer .sidebar-container {
background-color:#533F2A
}
3.88
8
add_action('after_setup_theme', function() {
$file = get_stylesheet_directory() . '/my-file.php';
if(!file_exists($file)) {
include_once ABSPATH . 'wp-admin/includes/file.php';
\WP_Filesystem();
global $wp_filesystem;
$wp_filesystem->put_contents($file, '', FS_CHMOD_FILE);
}
});
Thank you!
8
0
3.75
8
add_action('after_setup_theme', function() {
$file = get_stylesheet_directory() . '/my-file.php';
touch($file);
});
Thank you!
8
0
Are there any code examples left?
New code examples in category PHP
-
PHP 2022-03-27 22:40:03 index:of curiosa 2019 mp4
-
PHP 2022-03-27 22:35:13 Dijkstra’s algorithm php
-
PHP 2022-03-27 22:35:12 get_declared_classes
-
PHP 2022-03-27 22:30:23 php move index of a value to first position in array
-
PHP 2022-03-27 22:25:01 wordpress get_date
-
PHP 2022-03-27 21:30:38 php shorten string with dots
-
PHP 2022-03-27 21:10:46 php header 500
-
PHP 2022-03-27 21:05:06 laravel schedule run
-
PHP 2022-03-27 20:25:12 Get page title, excerpt or content by id
-
PHP 2022-03-27 20:00:27 php convert date from dd/mm/yyyy to yyyy-mm-dd