• Resolved splatcat1

    (@splatcat1)


    I need to create a Child theme but I seem to be having problems with the functions.php. Each time it brings up an error supposedly caused by the hyphen in the theme name. Am I doing something wrong? Is there a way around it?

    <?php
    // Add your custom functions here
    
    // Queue parent style followed by child/customized style
    add_action( 'wp_enqueue_scripts', 'zoom-lite_enqueue_child_styles', 99);
    
    function zoom-lite_enqueue_child_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
        wp_dequeue_style('zoom-lite-style');
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array('parent-style')
        );
    }
    
    ?>

    My apologies if I’ve got this wrong. I’m very new to child themes.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Theme Author GhozyLab

    (@ghozylab)

    Hello,

    No need to write any function in your child theme functions.php, also no need to wp_dequeue_style the main style.

    Just add one styles.css and functions.php in your child theme folder.

    You can download sample zoom child theme here : Download Sample ZOOM Lite Child

    Thread Starter splatcat1

    (@splatcat1)

    Many thanks for that, will give it a bash later tonight when the site is quiet.

    Just one more quick question. The functions.php file you have provided says “PLEASE DO NOT EDIT THIS FILE IN ANY WAY!” I assume I am however able to add functions to it in the child theme?

    Theme Author GhozyLab

    (@ghozylab)

    Hi @splatcat1

    Yes, correct…

    Thread Starter splatcat1

    (@splatcat1)

    Sorry one more question and then I’ll leave you in peace.

    I tried the Child Theme (only in live preview I didn’t get as far as using it for real). It reset all my theme options, everything from the images in the slider to the size of the thumbnails on the category pages, and the number of columns etc. It also (very strangely) messed up my widgets / sidebar throwing up some content in them from a previous theme!

    Is this “normal” (I disabled caching in case that was the issue).

    Theme Author GhozyLab

    (@ghozylab)

    @splatcat1

    We do not encounter any problems like you from here. Can you give me a video that can explain your problem?

    Thread Starter splatcat1

    (@splatcat1)

    Sorry I did go through and change everythingmanually so can’t really video it now.

    Bascally I had to redo all the choices in theTheme Editor. The very basic information from WordPress was there (Site Name, Tag LIne etc.) but all the theme options were back to their default. Hope this makes sense.

    Still think it’s a great theme, has even encouraged me to take a look at your gallery ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Creating a Child Theme’ is closed to new replies.