WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Child theme not functioning properly (9 posts)

  1. cryptq
    Member
    Posted 2 years ago #

    Hi, I hope someone can assist me.

    I've created a child theme from the twentyten theme called etienne and placed it in public_html/wp-content/themes/etienne/

    It contains the following files which I've edited: footer.php functions.php and style.css.

    My problem is that I have to change the names (or delete) the footer.php and functions.php file in the twentyten theme for it to work. Is there some code I need to change in my child theme files to get it to work?

    It's not a major issue, just a minor irritation. I want to update to the latest version but I'm hoping to solve this prior to the update and same myself the trouble.

    Thanks
    Etienne

  2. gerald@WPcustoms
    Member
    Posted 2 years ago #

    you`re on the right track. No changes are required to the original files.
    make sure you got your child style.css file set up properly.

    http://codex.wordpress.org/Child_Themes

  3. cryptq
    Member
    Posted 2 years ago #

    Thanks. The header of my style.css looks like this:

    /*
    Theme Name: Etienne Delport
    Theme URI:
    Description: A child theme of 2010 default WordPress theme.
    Author: Etienne Delport
    Author url:
    Version: 1.0
    Tags: black, blue, white, fixed-width, custom-header, theme-options
    Template: twentyten
    */
    @import url('../twentyten/style.css');
    
    /* Main global 'theme' and typographic styles */

    I cannot figure out why it ignores the functions & footer files in the child directory. When I update WP my css gets honored but it defaults to the twentyten functions and footer files.

  4. gerald@WPcustoms
    Member
    Posted 2 years ago #

    your child functions.php gets ADDED in front of the parent theme's function. it does not replace its content.

    but your footer.php should definitely overwrite the parent's footer.php content.
    maby the footerpart is somewhere added by the functions file? (as far as I remember twentyten loads a sidebar-footer.php file with the functions.php.

  5. cryptq
    Member
    Posted 2 years ago #

    Thank you kindly. Will check for the sidebar-footer.php. Just to clarify the situation re the functions.php. I copied the twentyten functions.php and edited out some functionality and added others. If I understand correctly from what you've said if I edited out "do function a" the parent's function.php will then declare that function. Need to rethink the way I'm doing that or just live with the irritation. Once again, many thanks.

  6. gerald@WPcustoms
    Member
    Posted 2 years ago #

    you`re right.
    have a quick look at this part where it says: "<strong><a href="http://codex.wordpress.org/Child_Themes">Using functions.php</a></strong>"

    if the function in the parent theme is set up conditionally it can be overwritten by a child function - it will have an IF function_exists statement at the beginning.

    if (!function_exists('theme_special_nav')) {
        function theme_special_nav() {
            //  Do something.
        }
    }<code></code>
    
    a quick and dirty workaround would be to copy and rename the function from the parent into your child's function and rename the function-call accordingly in the theme - i.e. your footer.php 
    
    the original function will still be loaded but since you
    re overwriting the call in your childtheme it won't affect anything.

  7. gerald@WPcustoms
    Member
    Posted 2 years ago #

    http://codex.wordpress.org/Child_Themes >> section: "Using Functions.php"

  8. cryptq
    Member
    Posted 2 years ago #

    Thank you, I've got it now. I've read that, more than once, but not being a native English or php :-) speaker I didn't comprehend exactly how it works. You've cleared it up for me.

    I'll think about my hacks again and find a solution.

  9. cryptq
    Member
    Posted 2 years ago #

    Thanks, you explained it brilliantly. Redid the way I did it and is now perfect.

Topic Closed

This topic has been closed to new replies.

About this Topic