Answers for "how to add files in theme editor wordpress"

PHP
0

how to add files in child theme in theme editor

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);
	}
});
Posted by: Guest on October-28-2020
0

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);
});
Posted by: Guest on October-28-2020

Code answers related to "how to add files in theme editor wordpress"

Browse Popular Code Answers by Language