Moving javascripts above the footer

Home Forums All Other Themes Moving javascripts above the footer

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #27286
    RonaldRonald
    Member
    • Topics: 4
    • Replies: 16
    • Total: 20
    Member since: February 27, 2016

    HI Guys,

    I would like to move some javascript outside my <head> section.
    How should I do that?

    #27652
    Sonnal S SinhaSonnal S Sinha
    Moderator
    • Topics: 0
    • Replies: 30587
    • Total: 30587
    Member since: August 16, 2013

    Hi,

    You have to do that manually unfortunately via appearance>editor>header.php

    Regards,
    Dave

    #27674
    RonaldRonald
    Member
    • Topics: 4
    • Replies: 16
    • Total: 20
    Member since: February 27, 2016

    Hi Dave,

    I understand that the scripts are generated within this section

    <?php
    wp_head();
    $themename = wp_get_theme();
    $themename = preg_replace(“/\W/”, “_”, strtolower($themename) );
    if( !get_option( $themename ) ) {
    require get_template_directory() . ‘/index-default.php’;
    exit;
    }
    ?>

    Are you suggesting that I should replace the code by static? Or is there any other way I can edit the script section and implement some of them in the footer?

    Regards,

    Ronald

    #27747
    Sonnal S SinhaSonnal S Sinha
    Moderator
    • Topics: 0
    • Replies: 30587
    • Total: 30587
    Member since: August 16, 2013

    Hi Ronald,

    All the javascripts listed on functions.php

    Regards,
    Dave

    #27748
    RonaldRonald
    Member
    • Topics: 4
    • Replies: 16
    • Total: 20
    Member since: February 27, 2016

    Hi Dave,

    Thank you for the reply. I have discovered the functions.php section.
    But my question remains: is there any other way I can edit the script section and implement some of them in the footer?

    Regards,
    Ronald

    #28481
    RonaldRonald
    Member
    • Topics: 4
    • Replies: 16
    • Total: 20
    Member since: February 27, 2016

    Hi Dave,

    Do you have a answer for my question?

    Regards,
    Ronald

    #28508
    Sonnal S SinhaSonnal S Sinha
    Keymaster
    • Topics: 10
    • Replies: 6964
    • Total: 6974
    Member since: June 12, 2013

    Hi Ronald,

    Actually this is quite difficult as this would involve shifting all of the javascripts manually to the footer and then ensuring whether this would work or not.

    Are you doing this for getting Google page speed ranking?

    Regards,
    Shri

    #28511
    RonaldRonald
    Member
    • Topics: 4
    • Replies: 16
    • Total: 20
    Member since: February 27, 2016

    Hi Shri,

    Yes I would like to move some of the scripts/css out of the header to gain loading speeds and satisfying users.

    Is there any way I can achieve this and if there is, how to go about it?

    Regards,

    Ronald

    #30997
    RonaldRonald
    Member
    • Topics: 4
    • Replies: 16
    • Total: 20
    Member since: February 27, 2016

    Hi Shri & Dave,

    Any luck finding an answer?

    Regards,

    Ronald

    #31016
    Sonnal S SinhaSonnal S Sinha
    Keymaster
    • Topics: 10
    • Replies: 6964
    • Total: 6974
    Member since: June 12, 2013

    Hi Ronald,

    Unfortunately shifting javascripts to footer breaks functioning of the theme.

    Regards,
    Shri

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.