• Resolved mattcrossette

    (@mattcrossette)


    I am a bit of a beginner, but I feel like I have a little more knowledge than just basic…but maybe not ??

    I have searched the forums and found many problems similar to mine, but nothing exactly. I am using the classified ads theme by SEOS and I have created a child theme based on the instructions here (great tutorial btw for anyone else that needs to know how to create a child theme). My problem is my child CSS works most of the time, but there are a few instances where it doesn’t. In those few times it doesn’t I have been able to use the !important and that makes a few more work, but still not all. There are still some elements I cannot change with the child CSS. They are still overridden by the parent. I did however find this work around that may give a clue as to what the problem is for someone that understands it better than myself. If I simply double the CSS like this:

    .img img {
        height: 100%;
    	width: 100%;
    }
    .img img {
    	height: 100%;
    	width: 100%;
    }

    It renders the way it’s supposed to! Any help would be appreciated. My child theme only has three files so far (the ones in the tutorial). Here is the functions.php in it’s entirety:

    <?php
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', PHP_INT_MAX);
    
    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' ) );
    }

    And here is my style.css in it’s entirety:

    /*
    Theme Name: classified ads child
    Description: Child theme for classified-ads
    Author: SEOS - Matt Crossette
    Author URI: https://seosthemes.com/
    Theme URI: https://seosthemes.com/wordpress-theme-classified-ads/
    Tags: red, two-columns, left-sidebar, responsive-layout, custom-background, custom-colors, custom-header, custom-menu, featured-images, threaded-comments
    Version: 1.09
    License: GNU General Public License v2.0
    License URI: https://www.gnu.org/licenses/gpl-2.0.html
    Text Domain: classified-ads
    Template: classified-ads
    */
    
    /* ----------------------------------- Basic ----------------------------------- */
    
    #header {
    	background-image: none;
    }
    
    #header-home {
    	height: 200px;
    }
    
    #header-img {
    	background-size: auto !important;
    	height: 200px !important;
    }
    
    .postanad {
    	display: none;
    }
    
    .img-def {
    	height: 50px;
    	width: auto;
    }
    .img-ad img {
        height: 50px;
    	width: auto;
    }
    
    .img-ad:hover {
        padding: 10px;
        transform: scale(4.2);
        position: absolute;
    }
    }
    
    .img img {
        height: 100%;
    	width: 100%;
    }
    .img img {
    	height: 100%;
    	width: 100%;
    }

    Any help is appreciated. Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mattcrossette

    (@mattcrossette)

    Oh, one other thing. My function.php file used to look like this:

    <?php
    add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
    
    function enqueue_parent_styles() {
       wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }

    I know nothing about PHP and the only reason I tried it both ways was because of some suggestions on some other threads. I don’t know what the difference is between the two. Is there one over the other I should be using?

    If I simply double the CSS like this:

    It renders the way it’s supposed to!

    possible because whatever style is before that, is broken …

    like those double closing barackets:

    }
    }

    where do they come from and is there an intended purpose of it?

    Thread Starter mattcrossette

    (@mattcrossette)

    Oh my goodness!!! I can’t believe I missed that! Thank you so much. That was it. I feel like such a newbie ??

    Thread Starter mattcrossette

    (@mattcrossette)

    Thanks again. Evidently I have to post another comment just to mark as resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Child CSS only works sometimes even with "!mportant"’ is closed to new replies.