Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #812022

    T7om
    Participant

    I would like to integrate the following Java Script into my Custom CSS. How could I get it work?

    <script type=”text/javascript”>
    window.cookieconsent_options = {“message”:”Diese Website verwendet Cookies, um Ihnen das bestmögliche Nutzungserlebnis bieten zu können.”,”dismiss”:”Verstanden”,”learnMore”:”Mehr Informationen”,”link”:”http://le-vinothek.de/datenschutz”,”theme”:”light-top”};

    <script type=”text/javascript” src=”//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.9/cookieconsent.min.js”>

    #812279

    Rupok
    Member

    Hi there,

    We recommend you to setup a Child Theme first to add your own customizations to the theme. In that way, you won’t be losing your custom code when updating the X Theme.

    Please check our guide on How to setup a Child Theme at this URL (http://theme.co/x/member/kb/how-to-setup-child-themes/).

    Once you activated the child theme, follow the code below and it to the Child Theme’s “functions.php” file.

    
    add_action( 'wp_head', 'my_custom_scripts' );
    
    function my_custom_scripts(){
    ?>
    <script type="text/javascript">
    window.cookieconsent_options = {“message”:”Diese Website verwendet Cookies, um Ihnen das bestmögliche Nutzungserlebnis bieten zu können.”,”dismiss”:”Verstanden”,”learnMore”:”Mehr Informationen”,”link”:”http://le-vinothek.de/datenschutz”,”theme”:”light-top”};
    </script>
    
    <script type=”text/javascript” src=”//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.9/cookieconsent.min.js”>
    
    <?php
    }
    

    To avoid any mistakes and would be easier for you to manage the code for the header or for the footer, please use a 3rd party plugin instead. You can install this plugin: https://wordpress.org/plugins/header-and-footer-scripts/

    Hope this helps. Please let us know how it goes.

    #812422

    T7om
    Participant

    Thanks for the reply. I already made a website, not using the child theme. Is there a way to copy all my “files” into the child theme?

    #812901

    Rue Nel
    Moderator

    Hello There,

    Do you know which file you have edited in your parent theme? If you can remember, you can simply copy those files and place in your child theme with the same folder where it is located in the parent theme. If you have added any custom functions in the parent theme’s functions.php file, you can remove that and place it into your child theme’s functions.php file instead. You do not have to worry about the customizer settings because you can save or export and import the XCS file by going to X Addons > Customizer manager. You must do export the XCS file first as your backup before activating the child theme.

    Hope this helps.

    #813328

    T7om
    Participant

    I haven’t touched any file. I just used Cornerstone to set up my pages and installed a couple plugins. I only used the Cutom CSS field.

    #813330

    T7om
    Participant

    I just installed the child theme. Now I understand how it works :D. The website is still working, thanks for the support.

    #813428

    Zeshan
    Member

    Glad to hear it’s working for you now! 🙂 Have a good day.