[Resolved] “Head Scripts” element used in the “Volume”

Home Forums Support [Resolved] “Head Scripts” element used in the “Volume”

Home Forums Support “Head Scripts” element used in the “Volume”

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1366664
    Marcel

    Could you please tell me what the “Head Scripts” hook element used in the “Volume” theme does?
    This is the script:

    <script>
    function showMe (it, box) {
      var vis = (box.checked) ? "none" : "block";
      document.getElementsByClassName(it)[0].style.display = vis;
    }
    </script>

    Thank you.

    #1366925
    Leo
    Staff
    Customer Support

    Hi there,

    Take a look at the explanation here:
    https://gpsites.co/volume/hook-elements/

    #1366945
    Marcel

    Simple thank you!

    #1367083
    Leo
    Staff
    Customer Support

    No problem ๐Ÿ™‚

    #2408851
    Alan

    Hi Leo,

    I have the same question as Marcel as I have the Head Scripts Element in my GP theme (not volume), but the script is the exact same and I have no idea what it does. Unfortunately, I looked at the link you sent Marcel and it was not simple to me.

    Can you please tell me what it does? I guess I’m not as technical as Marcel.

    This is the script in “Head Scripts” element (same as OP posted)–

    <script>
    function showMe (it, box) {
      var vis = (box.checked) ? "none" : "block";
      document.getElementsByClassName(it)[0].style.display = vis;
    }
    </script>'

    Much appreciated!
    Alan

    #2408865
    Leo
    Staff
    Customer Support

    I believe it’s a toggle button to show/hide comment as David explained here:
    https://generatepress.com/forums/topic/add-a-toggle-button-to-show-hide-comments/#post-871370

    #2408881
    Alan

    Ahh you are right, that is what it does. The person who built my site original put that sole snippet of code to hook on wp_head for some reason. Not sure why, but I just changed to the hook that David mentions in his thread and the comment toggle still works fine. Seems inefficient to run it in the head I would think (I’m working on speed improvements).

    Thank you!

    #2408882
    Leo
    Staff
    Customer Support

    No problem ๐Ÿ™‚

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