Skip to content

Instantly share code, notes, and snippets.

@cryptexvinci
Created November 2, 2016 05:27
Show Gist options
  • Save cryptexvinci/074ffaef38361c7aadf6a9c74ac71aa2 to your computer and use it in GitHub Desktop.
Save cryptexvinci/074ffaef38361c7aadf6a9c74ac71aa2 to your computer and use it in GitHub Desktop.
Wordpress Child Theme
<?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' );
}
?>
@netpassprod1
Copy link

netpassprod1 commented Mar 26, 2019

Line 2 in the code should NOT include the PHP_INT_MAX value in the priority parameter.
This results in the parent theme style rules taking precedence over the child style rules (defeating the purpose of the child theme) since the parent style file loads AFTER the child style file.
The call should simply be:
add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment