Skip to content

Instantly share code, notes, and snippets.

@Rakeshbagri
Created October 13, 2017 08:36
Show Gist options
  • Save Rakeshbagri/65dbcd3a4f1b706bdd7b0894285cc140 to your computer and use it in GitHub Desktop.
Save Rakeshbagri/65dbcd3a4f1b706bdd7b0894285cc140 to your computer and use it in GitHub Desktop.
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
function enqueue_child_theme_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>
create child theme folder
Step 1: Create a folder and name it anything you like. Ex: optimizer-child
Step 2: Create a file titled style.css
Step 3: Open the style.css and write below information
/*
Theme Name: Optimizer Child
Template: optimizer
*/
Step 4: Create a file titled functions.php and paste below code to import the parent themes style.
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
function enqueue_child_theme_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>
Step 5: Now Zip the folder and upload it via Appearance -> Themes -> Add New
Step 6: Activate the theme.
/*
Theme Name: Optimizer Child
Template: optimizer
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment