Support » Fixing WordPress » How cam I add this to code to my theme ?

  • Hi Guys.

    I’m looking for a little help, Im looking to, Im looking to learn how to do thing in wordpress and learn a little instead always turning to someone for every little thing.

    I want to add this to https://codepen.io/PixelatedOre/pen/bNZoVR wordpress and later add a online/offline icon and message count option to it but i’ve never do anything beyond the basic of css change or just copy and space code in the stated section.

    So I could really do with a little help.

    I’m assuming I need to add the html in the correct header php but do i add the css to the style.css or some other file ?
    also where do i add the JS Code ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You never want to edit your theme directly. Instead, create a child theme and make your changes there. You can enqueue css and js files from your child theme. Do you know how to create a child theme?

    Thread Starter akgt

    (@akgt)

    Thanks for the reply
    Yes I already have the child theme in place.

    The changes will be in a child theme.

    The JavaScript is a little confusing at the moment.

    JavaScript
    I create a new file name it,
    Do I place it in the JS folder or the theme root ?
    add the PHP code in functions,
    Something like this wp_enqueue_script( ‘script’, get_template_directory_uri() . ‘/js/script.js’, array ( ‘jquery’ ), 1.1, true); and change the get_template_directory_uri to the location of the file ?

    Yes, the javascript, like the css, would go in its own file. There are instructions on how to properly enqueue these scripts here:

    https://codex.wordpress.org/Child_Themes

    Look about a third of the way down the page.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How cam I add this to code to my theme ?’ is closed to new replies.