• Hi All,

    Firstly, I’m new to this!

    I’ve got the parent – child theme working but I’m not understanding it now that it is all installed. All youtube videos state that when you change something in the parent theme it may get changed when parent theme it gets updated. I understand that and it makes sense too. What I’m not getting is do I now not change anything in the parent theme and end-up moving from ‘page builder’ to programming an empty .css file.

    Basically where do you stop using the WP theme change functionality and use the child .css file. It basically becomes a steep learning curve trying accomplish the same outcome using CSS.

    I MUST be missing something here surely!!!

    Regards
    jsgthomson

Viewing 4 replies - 1 through 4 (of 4 total)
  • David_G

    (@questas_admin)

    You use your child theme for special functions and/or styles you want to have on your site. Other files can be added to the child theme as the need arises. But those files in the child theme stay static when the parent theme and WP core files are updated.

    Thread Starter jsgthomson

    (@jsgthomson)

    Ok – get that. Bur it still mweans all the non special functions/changes are lost.

    Sorry its back to basics but im learning parent child themes and its a bit confusing where to draw a line. For example do I use theme built in functionality of the theme to change from std home page to a parallax or do i create the coding in child theme (the steep learning curve bit). Most vids online show changing the background colour etc
    Jsgthomson

    I’m not sure exactly what it is you’re trying to do.

    For the most part, you make changes in your child’s css file.

    Your css file must start with something like this. The “template” part is essential.

    /*
     Theme Name:     your theme name
     Theme URI:      your WP website
     Description:    child theme of the parent you've chosen
     Author:         you and the parent author
     Author URI:     otional website address
     Version:        1.0.0
     Template:       exact name of the parent (use copy and paste)
    */

    Also, create a functions.php file (open a text editor like notepad) and copy and paste the following into it:

    <?php
    
    /*...............
    replace import of parent's style on style.css
    ...............*/
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    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')
        );
    }
    
    ?>

    Make sure there are zero spaces or line breaks before the first <?php and the last ?>.

    Save the file as functions.php and put it in your theme’s folder.

    Most cosmetic changes can be made in the css…. Consult the parent css file to find the ids and classes. You only have to change the ids or classes that you want changed (ie: you don’t have to include the whole of the parent css file)

    I hope that made sense! If not, have you seen this? It’s very handy.
    https://www.wpbeginner.com/wp-themes/how-to-create-a-wordpress-child-theme-video/

    Try reading through some of these.

    https://www.wpbeginner.com/beginners-guide/wordpress-child-theme-pros-cons/
    https://www.wpbeginner.com/glossary/parent-theme/
    https://codex.www.ads-software.com/Child_Themes

    I think what you are missing is that a parent theme is a stand only theme. If you have your parent theme activated then that is the only theme activated. If you create a child theme it is basically modifications to the parent theme. If the child theme is activated then whatever parent theme the child theme is pointing to will also be activated. So basically in the child theme you copy all the parent theme files that you want to modify. That way when you update your parent theme all your child theme modifications are still there (so you don’t lose anything).

    If you don’t understand this then I would suggest reading through the links above.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘When to change Parent or Child’ is closed to new replies.