• Hello Team.

    I created a child’s theme cause my main theme has to update.

    1. Made FTP file in themes/basil-child

    2. Activated basil-child on wordpress.

    3. Followed rules on wordpress guidelines for childs theme

    /*
     Theme Name:     basil-child
     Theme URI:      http://www.facultyoffood.com/wp-content/themes/basil-child
     Description:    Basil Child Theme
     Author:         Boxy Studio
     Author URI:     http://boxystudio.com
     Template:       basil
     Version:        99
    */
    
    @import url("../basil/style.css");
    
    /* Theme customization starts here
    -------------------------------------------------------------- */
    .basilsocials { font-size: 20px !important; }

    I even used !important to prioritize the childs theme edits over the parent theme.

    However, no changes are made. I can only make changes to the site, if I make edits to the parent theme, which I do not want. Any tips can help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Can you post a link to your site with the child theme activated?

    Thread Starter facultyoffood

    (@facultyoffood)

    Okay looks like It’s not the CSS problem, but php.

    So here is the problem.
    Let’s say there is a function called render_social , that renders social buttons in header.php [parent]

    I create a new social render that seperates two different colors in childs theme, calling it render_social_child
    [child]

    but the problem is, how do I call it?
    I had to go to header.php in parent theme and change it’s call of render_social to render_social_child
    , but that meant I had to change the parent theme code

    what can I do?

    Thread Starter facultyoffood

    (@facultyoffood)

    In your case, you would copy header.php from your parent theme to the child theme and make the change from render_social() to render_social_child() in the copy of header.php in the child theme’s folder. WordPress will use the copy that’s in your child theme.

    Thread Starter facultyoffood

    (@facultyoffood)

    Thanks Stephencottontail, I made a little mistake.

    the function is not in header.php
    it’s CALLED in header.php, but exists in functions.php

    Do I just import all the php files from parent into childs?

    Generally speaking, the only PHP files you should copy from the parent to the child are the ones you’d like to change. functions.php is a special case, though: WordPress will first load the child’s copy (if it exists) and then the parent’s copy.

    In your case, you could create a functions.php in your child theme’s folder, define the function render_social_child(), copy the header.php to your child theme’s folder, rewrite the call from render_social() to render_social_child() and you should be good to go.

    If the function render_social() is pluggable (it’s surrounded with if ( ! function_exists( 'render_social' ) )), then it’s even easier. You would just redefine the function in your child theme’s functions.php and you wouldn’t even need to copy header.php to your child theme.

    You have to remember that class names and IDs are case-sensitive. So this rule in your child theme:

    .basilsocials { font-size: 20px !important; }

    needs to be changed to this:

    .basilSocials { font-size: 20px; }

    That is, the first S in “Socials” needs to be capitalized. And you don’t need the !important clause.

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

The topic ‘[CRITICAL] Child Theme Not Working!’ is closed to new replies.