Skip to main content
fixed indentation
Source Link
fuxia
  • 107.3k
  • 39
  • 256
  • 463
  • De-enqueue the Parent-Theme stylesheet, via wp_dequeue_style( $handle )

  • Remove the Parent Theme callback that enqueues the style, via remove_action( $hook, $callback )

  • Use the CSS cascade to override the Parent-Theme stylesheet, by hooking your Child-Theme stylesheet wp_enqueue_style() call into the same hook with a lower priority or into a later hook.

    For this last option, if the Parent Theme uses:

     `add_actionadd_action( 'wp_enqueue_scripts', 'parent_theme_enqueue_style', $priority )`; 

    ...then the Child Theme would use:

     `add_actionadd_action( 'wp_enqueue_scripts', 'child_theme_enqueue_style', {$priority + 1} )`; 
  • De-enqueue the Parent-Theme stylesheet, via wp_dequeue_style( $handle )

  • Remove the Parent Theme callback that enqueues the style, via remove_action( $hook, $callback )

  • Use the CSS cascade to override the Parent-Theme stylesheet, by hooking your Child-Theme stylesheet wp_enqueue_style() call into the same hook with a lower priority or into a later hook.

    For this last option, if the Parent Theme uses:

     `add_action( 'wp_enqueue_scripts', 'parent_theme_enqueue_style', $priority )` 

    ...then the Child Theme would use:

     `add_action( 'wp_enqueue_scripts', 'child_theme_enqueue_style', {$priority + 1} )` 
  • De-enqueue the Parent-Theme stylesheet, via wp_dequeue_style( $handle )

  • Remove the Parent Theme callback that enqueues the style, via remove_action( $hook, $callback )

  • Use the CSS cascade to override the Parent-Theme stylesheet, by hooking your Child-Theme stylesheet wp_enqueue_style() call into the same hook with a lower priority or into a later hook.

    For this last option, if the Parent Theme uses:

    add_action( 'wp_enqueue_scripts', 'parent_theme_enqueue_style', $priority ); 

    ...then the Child Theme would use:

    add_action( 'wp_enqueue_scripts', 'child_theme_enqueue_style', {$priority + 1} ); 
  1. style.css, directly in the document head (thus before wp_head() is fired)

  2. {varietal}.css, at wp_enqueue_scripts, with priority 11, in functions/dynamic-css.php:

     /** * Enqueue Varietal Stylesheet */ function oenology_enqueue_varietal_style() {   // define varietal stylesheet   global $oenology_options;   $oenology_options = oenology_get_options();   $varietal_handle = 'oenology_' . $oenology_options['varietal'] . '_stylesheet';   $varietal_stylesheet = get_template_directory_uri() . '/varietals/' . $oenology_options['varietal'] . '.css';   wp_enqueue_style( $varietal_handle, $varietal_stylesheet ); } // Enqueue Varietal Stylesheet at wp_print_styles add_action('wp_enqueue_scripts', 'oenology_enqueue_varietal_style', 11 ); 
  1. style.css, directly in the document head (thus before wp_head() is fired)

  2. {varietal}.css, at wp_enqueue_scripts, with priority 11, in functions/dynamic-css.php:

     /** * Enqueue Varietal Stylesheet */ function oenology_enqueue_varietal_style() { // define varietal stylesheet global $oenology_options; $oenology_options = oenology_get_options(); $varietal_handle = 'oenology_' . $oenology_options['varietal'] . '_stylesheet'; $varietal_stylesheet = get_template_directory_uri() . '/varietals/' . $oenology_options['varietal'] . '.css'; wp_enqueue_style( $varietal_handle, $varietal_stylesheet ); } // Enqueue Varietal Stylesheet at wp_print_styles add_action('wp_enqueue_scripts', 'oenology_enqueue_varietal_style', 11 ); 
  1. style.css, directly in the document head (thus before wp_head() is fired)

  2. {varietal}.css, at wp_enqueue_scripts, with priority 11, in functions/dynamic-css.php:

     /** * Enqueue Varietal Stylesheet */ function oenology_enqueue_varietal_style() {   // define varietal stylesheet   global $oenology_options;   $oenology_options = oenology_get_options();   $varietal_handle = 'oenology_' . $oenology_options['varietal'] . '_stylesheet';   $varietal_stylesheet = get_template_directory_uri() . '/varietals/' . $oenology_options['varietal'] . '.css';   wp_enqueue_style( $varietal_handle, $varietal_stylesheet ); } // Enqueue Varietal Stylesheet at wp_print_styles add_action('wp_enqueue_scripts', 'oenology_enqueue_varietal_style', 11 ); 
added 17 characters in body
Source Link
Chip Bennett
  • 55.1k
  • 8
  • 91
  • 170
  • De-enqueue the Parent-Theme stylesheet, via wp_dequeue_style( $handle )

    De-enqueue the Parent-Theme stylesheet, via wp_dequeue_style( $handle )

  • Remove the Parent Theme callback that enqueues the style, via remove_action( $hook, $callback )

    Remove the Parent Theme callback that enqueues the style, via remove_action( $hook, $callback )

  • Use the CSS cascade to override the Parent-Theme stylesheet, by hooking your Child-Theme stylesheet wp_enqueue_style() call into the same hook with a lower priority or into a later hook.

    Use the CSS cascade to override the Parent-Theme stylesheet, by hooking your Child-Theme stylesheet wp_enqueue_style() call into the same hook with a lower priority or into a later hook.

    For this last option, if the Parent Theme uses:

     `add_action( 'wp_enqueue_scripts', 'parent_theme_enqueue_style', $priority )` 

    ...then the Child Theme would use:

     `add_action( 'wp_enqueue_scripts', 'child_theme_enqueue_style', {$priority + 1} )` 

For the last option, if the Parent Theme uses:

`add_action( 'wp_enqueue_scripts', 'parent_theme_enqueue_style', $priority )` 

...then the Child Theme would use:

`add_action( 'wp_enqueue_scripts', 'child_theme_enqueue_style', {$priority + 1} )` 
  • De-enqueue the Parent-Theme stylesheet, via wp_dequeue_style( $handle )
  • Remove the Parent Theme callback that enqueues the style, via remove_action( $hook, $callback )
  • Use the CSS cascade to override the Parent-Theme stylesheet, by hooking your Child-Theme stylesheet wp_enqueue_style() call into the same hook with a lower priority or into a later hook.

For the last option, if the Parent Theme uses:

`add_action( 'wp_enqueue_scripts', 'parent_theme_enqueue_style', $priority )` 

...then the Child Theme would use:

`add_action( 'wp_enqueue_scripts', 'child_theme_enqueue_style', {$priority + 1} )` 
  • De-enqueue the Parent-Theme stylesheet, via wp_dequeue_style( $handle )

  • Remove the Parent Theme callback that enqueues the style, via remove_action( $hook, $callback )

  • Use the CSS cascade to override the Parent-Theme stylesheet, by hooking your Child-Theme stylesheet wp_enqueue_style() call into the same hook with a lower priority or into a later hook.

    For this last option, if the Parent Theme uses:

     `add_action( 'wp_enqueue_scripts', 'parent_theme_enqueue_style', $priority )` 

    ...then the Child Theme would use:

     `add_action( 'wp_enqueue_scripts', 'child_theme_enqueue_style', {$priority + 1} )` 
added 2005 characters in body
Source Link
Chip Bennett
  • 55.1k
  • 8
  • 91
  • 170
Loading
Source Link
Chip Bennett
  • 55.1k
  • 8
  • 91
  • 170
Loading