Site logo

[Resolved] Child PHP not working?

Home Forums Support [Resolved] Child PHP not working?

Home Forums Support Child PHP not working?

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1700566
    Elizabeth

    Hi amazing GP support team! I’m adding some small animations to my site using wow.js.uk; I was able to add their PHP code snippet to the GP header.php with no problems – and it works great. However, when I try to place the same snippet in my child functions.php (using your official child theme) it won’t work or even save it. It won’t let me add it using the Snippets plugin, either. Here’s the code:

    <head>
    <link
    rel=”stylesheet”
    href=”https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css&#8221;
    />
    </head>

    Is there something different with the GP Child for this? Please help, thanks!

    #1700634
    Leo
    Staff
    Customer Support

    Hi there,

    You will need to copy the header.php file and put it in your child theme and make the modification there.

    Let me know if this helps 🙂

    #1701114
    Elizabeth

    Ahh, thanks! And which .php theme file should I copy and add it to if I want the animations to work on the whole home page or other subpages?

    #1701115
    Leo
    Staff
    Customer Support

    The header.php file as mentioned in the previous reply:
    https://github.com/tomusborne/generatepress/blob/master/header.php

    Just add that file to your child theme’s folder and make the modification there.

    #1701978
    Elizabeth

    Thanks Leo, I did that right away but it’s still only working in the header element. I’ve tried adding the class in the Advanced “Additional CSS class(es)” spot, as well as manually via the “edit as html” and it won’t work in the body section no matter what. So that’s why I was wondering if the “header.php” file is only activating it in the headers of the site. Please advise, thanks!

    #1702396
    Leo
    Staff
    Customer Support

    I see it working in the header element.

    Where else are you using it?

    #1702427
    Elizabeth

    Right now I have it in some of the other home page blocks, but they don’t work. I’d like to be able use it everywhere (home page, some other blocks on subpages.

    #1702435
    Leo
    Staff
    Customer Support

    I think it might only work for text but I’m not sure.

    Sorry it’s a custom script and not something from GP so I’m not really sure how it works.

    I can only tell you how to implement the code as you instructed and it’s definitely working as seen in the header element.

    You might need to check with the code author to see exactly how the animation works.

    #1704240
    Elizabeth

    Thanks Leo: I know it can work with any html element, I just can’t find which GP theme php file it should be added to so it applies to the whole site and not just the header. Can you enlighten me on that?

    #1704255
    Leo
    Staff
    Customer Support

    The header actually exists in every page of the site so the code added there would apply to the entire site.

    #1704393
    Elizabeth

    Ok, but could it be only working in the header element because it’s only pasted in the header.php file?

    #1704432
    Leo
    Staff
    Customer Support

    Ahh I see where the confusion is coming from but no – header and header element are two completely different/unrelated things 🙂

    #1705831
    Elizabeth

    Ok, thanks anyways. I guess I will have to try using a plug in, maybe the Blocks Animation one… 🙁

    #1706819
    Leo
    Staff
    Customer Support

    No problem 🙂

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