• Resolved eugeneormktg

    (@eugeneormktg)


    I am making edits to a website that I did not create originally. In order to make my style edits, I tried to make a child theme so i would not affect the original theme settings. The previous developer created a custom theme, and it looks like he created a PHP template for the homepage. Their style.css file is blank except for the header info.

    I created a child theme and it links fine to the custom theme – I can tell this because it is referencing the child theme and the site looks the same as when the custom theme is active.

    BUT – none of the CSS I add to my style sheet takes effect (even with !important) and also nothing happens when I add CSS to the custom (original) style sheet either.

    This makes me think that there is something in the PHP file that is keeping my changes from being read, and I can only do CSS and HTML, I am very limited in PHP.

    I am thinking that I need to add something to the functions PHP in my child theme?

    the website is http://www.flyrv12.com and my child theme is active now.

    Thank you for reading this!

Viewing 15 replies - 1 through 15 (of 15 total)
  • The original theme is called rv12? What did you name the child theme? I don’t see a link to your child theme’s style.css file. I assume you followed the instructions here when creating your child theme?

    Thread Starter eugeneormktg

    (@eugeneormktg)

    Thank you for your reply. The original theme is called rv12, my child theme is called eomtheme, it is active.

    My style.css header is simply…

    /*
    Theme Name: eomtheme
    Template: rv12
    */

    I did follow the steps in the codex, and I have done this with success before. It seems like the previous developer wrote a whole theme from scratch – whereas I do everything as a child theme based on a parent theme, but this approach is not working in this case.

    UPDATE – I added the following to my style sheet so you could see something – this should have removed the logo, as it does in chrome’s developer tools (inspector)

    .logo-area {
    display: none !important;
    }

    So when you go to Appearance → Themes, you see your child theme listed, i.e., eomtheme?

    Can you try changing the style.css header of your child theme to this, and also add the simple test rule to see if it’s working:

    /*
     Theme Name:   eomtheme
     Theme URI:    http://www.flyrv12.com/eomtheme/
     Description:  EOM Child theme
     Template:     rv12
     Text Domain:  eomtheme
    */
    
    h4 {
        color: #ff0000;
    }

    Thread Starter eugeneormktg

    (@eugeneormktg)

    I just did as you requested and got no red h4 text. Just to be double sure I also added the test rule (then removed it) to the rv12 style.css sheet. Still no red text. It is as though the css is inactive and the styles are being ruled from somewhere else?

    I would venture to guess if I called out the correct location in the functions.php in my child theme it might work?

    UPDATE – when I dig into the rv12 functions.php file I see a lot of colors and other rules being set there, not sure if that is where he did all his styling?

    You put the test rule in /wp-content/themes/rv12/style.css? I don’t see it there.

    Also, you went to Appearance → Themes and you could see the child theme there?

    Thread Starter eugeneormktg

    (@eugeneormktg)

    I placed it in both to test – but now it is only in /eomtheme/style.css

    Thread Starter eugeneormktg

    (@eugeneormktg)

    Yes I can see it in Appearance → Themes

    OK, so next step, what does your child theme’s function.php file look like? You might need to enqueue your child theme’s style.css file.

    Thread Starter eugeneormktg

    (@eugeneormktg)

    eomtheme functions.php reads…

    <?php

    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
    function theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );

    }

    Thread Starter eugeneormktg

    (@eugeneormktg)

    The thing is that the rv12 style.css sheet doesn’t react to adding rules either?

    Can you put the test rule back in the rv12 style.css file so I can take a look?

    Change your functions.php file to this:

    <?php
    function my_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 )
        );
    }
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    ?>

    Thread Starter eugeneormktg

    (@eugeneormktg)

    BOOM! I HAVE RED H4 TEXT!! Child theme working…

    You are the man!

    Thread Starter eugeneormktg

    (@eugeneormktg)

    THANK YOU FOR RESOLVING THIS! What was the issue?

    I mentioned earlier that I didn’t see a link for your child theme’s style.css file. In the Child theme codex, it says this:

    Your child theme’s stylesheet will usually be loaded automatically. If it is not, you will need to enqueue it as well. Setting ‘parent-style’ as a dependency will ensure that the child theme stylesheet loads after it.

    After that paragraph is the sample code for functions.php that I posted above. That enqueued (i.e., brought in) the child theme’s stylesheet into the head section of your web page.

    Thread Starter eugeneormktg

    (@eugeneormktg)

    Thank you again for your help and patience. I am good with graphics, HTML and CSS but when I get into any “script” code I am lost, even with the codex I sometimes find that I need it explained to me before I get it. I appreciate you sharing your knowledge with me. Have a good night!

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

The topic ‘Child Theme Won't Work with Custom Theme (PHP preventing CSS?)’ is closed to new replies.