Site logo

Archived topic

Child PHP not working?

13 replies · Started by Elizabeth on March 18, 2021

Viewing posts 1–14 of 14

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"
/>
</head>

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

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 :)

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?

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!

I see it working in the header element.

Where else are you using it?

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.

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.

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?

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

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

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

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

No problem :)

This archived topic is closed to new replies.