I’m trying to create a WordPress child theme, but I can’t seem to get it to override styles in the parent theme.

functions.php

<?php

if ( ! function_exists( 'my_theme_enqueue_styles' ) ) {
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );

    function my_theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    }
}

/**
 *    WP Enqueue Stylesheets
 */
if ( ! function_exists( 'rev_cust_enqueue_stylesheets' ) ) {
    add_action( 'wp_enqueue_scripts', 'rev_cust_enqueue_stylesheets' );

    function rev_cust_enqueue_stylesheets() {
        wp_enqueue_style( 'rev-main', get_template_directory_uri() . '/layout/css/rev_main.css', array(), '', 'all' );
    }
}

?>

rev_main.css

#header .top-header .header-navigation ul li {
    margin-left: 40px;
    line-height: 1.375;
    font-weight: normal !important;
    font-size: 1px;
    color: #fff;
    text-transform: uppercase;
    position: relative;
    float: left;
 }

Why isn’t my style class not being picked?

Thank you all in advance.

Read more here: How to override CSSin WordPress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: