Title: Child theme style problem
Last modified: August 30, 2016

---

# Child theme style problem

 *  [exelexys](https://wordpress.org/support/users/exelexys/)
 * (@exelexys)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/child-theme-style-problem/)
 * For some reason, colors set in WP FanZone child theme aren’t the same for menus/
   submenus as when WP FanZone (parent) is active.
 * Specifically, anchor hover color and text-decoration for menu / submenus differ
   between parent and child. Per Firebug, these CSS styles are loaded when WP FanZone
   parent theme is active:
 *     ```
       responsive.css (line 887):
       *::before, *::after {
           box-sizing: border-box;
       }
   
       styles.css (line 453):
           a:hover, a:focus, a:active {
       }
       ```
   
 * When the child theme is active, the above styles are also loaded, but these two
   style declarations are sandwiched in between them:
 *     ```
       responsive.css (line 922):
       a:focus {
           outline: thin-dotted;
           outline-offset: -2px;
       }
   
       responsive.css (line 917):
       a:hover, a:focus {
           color: #339390;
           text-decoration: underline;
       }
       ```
   
 * Any idea why this is happening? Has my child theme been created incorrectly?
 * This problem isn’t browser-specific, and doesn’t appear to be plugin-related.
 * Many thanks in advance!

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Thread Starter [exelexys](https://wordpress.org/support/users/exelexys/)
 * (@exelexys)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/child-theme-style-problem/#post-6215436)
 * After more troubleshooting, problem seems to be solved by enqueuing parent stylesheet
   responsive.css in addition to parent stylesheet styles.css in child’s functions.
   php file like this:
 *     ```
       wp_enqueue_style( 'parent-wp_fanzone_responsive', get_template_directory_uri() .'/css/responsive.css', array(), false ,'screen' );
       ```
   
 * Used this helpful section from [Child Themes](https://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme)
   article in WordPress Codex.
 * Not sure if this an outcome of using [Underscores](http://underscores.me) but
   it wasn’t obvious this needed to be done.
 * Wondering if other styleshhets the theme references need to be enqueued the same
   way?
 *  Thread Starter [exelexys](https://wordpress.org/support/users/exelexys/)
 * (@exelexys)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/child-theme-style-problem/#post-6215526)
 * Disregard my previous post. Issue seemed fixed, but upon revisiting the site 
   today, problem continues.
 * Sorry for confusion.
 *  Thread Starter [exelexys](https://wordpress.org/support/users/exelexys/)
 * (@exelexys)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/child-theme-style-problem/#post-6215529)
 * Something is awry with stylesheet loading.
 * At the very least, though the child stylesheet appears in <head> its styles don’t
   appear to be loading:
 *     ```
       <link rel='stylesheet' id='parent-style-css'  href='http://windycitygreek.com/wp-content/themes/wp-fanzone/style.css?ver=4.2.2' type='text/css' media='all' />
       <link rel='stylesheet' id='wp_fanzone_slider-css'  href='http://windycitygreek.com/wp-content/themes/wp-fanzone/css/slider.css?ver=4.2.2' type='text/css' media='screen' />
       <link rel='stylesheet' id='wp_fanzone_responsive-css'  href='http://windycitygreek.com/wp-content/themes/wp-fanzone/css/responsive.css?ver=4.2.2' type='text/css' media='screen' />
       ...
       ...
       <link rel='stylesheet' id='wp-fanzone-style-css'  href='http://windycitygreek.com/wp-content/themes/wp-fanzone-child/style.css?ver=4.2.2' type='text/css' media='all' />
       ```
   
 * This likely isn’t the cause of the original problem, but a likely a symptom of(
   faulty) child theme creation.
 * Troubleshooting out loud.
 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/child-theme-style-problem/#post-6215530)
 * Can you post a link to your site with the child theme active?
 *  Thread Starter [exelexys](https://wordpress.org/support/users/exelexys/)
 * (@exelexys)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/child-theme-style-problem/#post-6215531)
 * Site is under development but have just made it available for troubleshooters
   =):
 * [http://is.gd/5ScalM](http://is.gd/5ScalM)
 * Menu anchors retain parent theme color on hover and menu/submenu anchors shouldn’t
   be underlined on hover.
 * Note this is the content of child theme functions.php:
 *     ```
       add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
       function theme_enqueue_styles() {
           wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
           wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style') );
       }
       ```
   
 * Tried removing the child stylesheet enqueuing since it occurs in parent functions.
   php but it didn’t seem to help.
 * Thanks in advance!
 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/child-theme-style-problem/#post-6215536)
 * Your theme is coded a little strangely and there’s some weird cascading for the
   menu links between the main `style.css` and `responsive.css`. If you use the 
   code given in the Codex article with this theme, the stylesheets get loaded in
   the wrong order and that’s why your menu links have the wrong color on hover.
   Instead, try this code instead:
 *     ```
       <?php
   
       add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 11 );
       function theme_enqueue_styles() {
               wp_dequeue_style( 'wp-fanzone-style' );
               wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
               wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style') );
       }
       ```
   
 *  Thread Starter [exelexys](https://wordpress.org/support/users/exelexys/)
 * (@exelexys)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/child-theme-style-problem/#post-6215554)
 * Thanks verrrry much, that did the trick!
 * Couple of questions, to avoid this problem in the future:
    – why did you need
   to set priority on add_action()? – in what order should parent and child themes
   load stylesheets, and how did this theme load them?
 * Thanks again!
 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/child-theme-style-problem/#post-6215555)
 * I had to set priority in the child theme’s `functions.php` so that the stylesheets
   would be loaded in the proper order. Normally, when you use a child theme, WordPress
   loads the child theme’s `functions.php` first and then the parent theme’s `functions.
   php`. The default priority is 10, and lower priority functions are executed first,
   so by setting the child theme’s function priority to 11, it forces WordPress 
   to load the child theme’s function after the parent theme’s equivalent function.
 * What happens with your theme is that the colors (including the colors for the
   visited and hover states) for your `<a>` tags are defined in `responsive.css`,
   which is loaded first, and then your theme’s main stylesheet overrides `responsive.
   css` just for the menu links, making them white (including the visited and hover
   states). This works because your theme loads `responsive.css` first and the main
   stylesheet is loaded afterwards.
 * But when you make a child theme using the code from the Codex, the main stylesheets
   for both the parent theme and the child theme are loaded first (remember that
   WordPress loads the child theme’s `functions.php` first), and then `responsive.
   css` is loaded. This causes the inheritance chain to break and the hover color
   for the `<a>` tag as defined in `responsive.css` “leaks” through.
 * (It’s okay if you don’t fully understand the last paragraph, because to tell 
   the truth, I don’t fully understand it either, at least not to the point where
   I can completely explain why it works the way it does. If there’s a takeaway 
   lesson here, it’s that you should always define the hover and visited states 
   for `<a>` tags.)
 *  Thread Starter [exelexys](https://wordpress.org/support/users/exelexys/)
 * (@exelexys)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/child-theme-style-problem/#post-6215589)
 * Hope the theme creator modifies the way the stylesheets are loaded or the way
   they work so problems like these can be avoided in the future.
 * Thanks very much for your help. Greatly appreciated!

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Child theme style problem’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/wp-fanzone/3.2/screenshot.png)
 * WP FanZone
 * [Support Threads](https://wordpress.org/support/theme/wp-fanzone/)
 * [Active Topics](https://wordpress.org/support/theme/wp-fanzone/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/wp-fanzone/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/wp-fanzone/reviews/)

## Tags

 * [child theme](https://wordpress.org/support/topic-tag/child-theme/)

 * 9 replies
 * 2 participants
 * Last reply from: [exelexys](https://wordpress.org/support/users/exelexys/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/child-theme-style-problem/#post-6215589)
 * Status: not resolved