• I’m trying to figure out why my style.css is not overriding the parent style.css.
    My child theme folder structure looks like this:

    themes
    - simplemag
      - style.css
      - css
        - icons.css
        - framework.css
      - [some other folders and files]
    - simplemag-child
      - css
        - icons.css
        - framework.css
      - [some other folders and files]
      - style.css
      - functions.php

    style.css from the child theme

    /*
    Theme Name: SimpleMag
    Theme URI: http://themesindep.com/
    Author: ThemesIndep
    Author URI: http://themesindep.com/
    Description: Magazine theme for creative things
    Template: simplemag
    Version: 2.0
    */
    
    /* Your CSS code goes here */
    
    /*
    .post .content p {
    text-align:justify;
    }
    */
    
    @media only screen and (min-width: 801px) {
    	.entry-image {
    		opacity:1;
    	}
    }

    functions.php from the child theme

    <?php
    /**
     * SimpleMag child theme functions & definitions
     * child theme: simplemag-child/style.css
     * child theme version 2.0
     * parent theme: simplemag/style.css
     * parent theme version 2.2.1
    **/
    
    function theme_enqueue_styles() {
    
        $parent_style = 'parent-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 ),
            wp_get_theme()->get('Version')
        );
    }
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    
    ?>

    Could any one help to me to see what I am missing?

    • This topic was modified 9 years, 3 months ago by qvyang.
    • This topic was modified 9 years, 3 months ago by qvyang.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Can you post a link to your site?

    Thread Starter qvyang

    (@qvyang)

    It’s a bit difficult to piece together your stylesheets because your caching plugin stripped out the headers, but your code snippets you posted seem to look okay. I can’t find the CSS from your child theme’s stylesheet that you posted in your original post, though. Can you post a concrete example of some code in your child theme’s stylesheet that isn’t overriding the parent theme’s CSS? Also, you might consider asking your theme’s authors for assistance as well: http://www.themesindep.com/support/forums/forum/simplemag/

    Thread Starter qvyang

    (@qvyang)

    Thank you so much for looking into this for me. It’s surprising to know that a plugin is stripping out the headers because I don’t have any caching plugin installed. The code I posted in my original post is all I have in the child theme’s stylesheet. Yes, I’ll contact the theme author. Thank you!

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

The topic ‘Child theme CSS not overriding parent theme’ is closed to new replies.