• Resolved theduck

    (@theduck)


    I’m so close, but I’m obviously missing something… I am trying to implement a child theme in order to add google analytics without a plugin. I have it to the point that it does work, however I’m losing some of my style when I activate my child theme (nav menu disappears, incorrect footer). I know if there’s more than one style sheet you have to enqueue each style sheet, however I thought I saw that this wasn’t necessary with this theme. Perhaps that’s where I’m going wrong. This is what I have in my child theme css file and functions file –

    Css:

    /*
    Theme Name: Virtue Child Theme
    Theme URI: https://themes.kadencethemes.com/virtue/
    Description: Child Theme for Virtue
    Author: Kadence Themes
    Author URI: https://kadencethemes.com/
    Template: virtue
    Version: 1.0
    */

    Functions:

    <?php
    function myanalytics() {
    ?>

    <script>
    (function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’);

    ga(‘create’, ‘UA-34376773-1’, ‘auto’);
    ga(‘require’, ‘displayfeatures’);
    ga(‘require’, ‘linkid’, ‘linkid.js’);
    ga(‘send’, ‘pageview’);

    </script>
    <?php
    }
    add_action(‘wp_head’, ‘myanalytics’);
    ?>

    (Let’s see if I got that “backticks” correct and my code actually shows)

    Any help would be greatly appreciated ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey,
    All themes have there own database table for the menu and widgets. Once you activate a different theme (even a child theme) you have to assign the menus and widgets where you want them to be. There isn’t an issue with your child theme just have to reassign the menus and widgets.

    Kadence Themes

    Thread Starter theduck

    (@theduck)

    Ahhh, thanks! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Child theme issue’ is closed to new replies.