Site logo

Archived topic

Element not loading (Elements)

3 replies · Started by Sil on July 20, 2021

Viewing posts 1–4 of 4

Bit of a weird one here. Hope you can help.

I created an Element with 2 location based display rules.
- Page X (our contact page)
- Page Y (our services page)

The Element includes a script in the body and is based on the hook 'generate_after_content'.

The result:
The script is included on page X, but not on Page Y.

When logged into WP admin, when viewing Page Y, it displays the Element in the admin heading bar when I click the 'Element (2)' item.
But the script that the Element is including does not seem to show up in page source.
On Page X same, but the script does show up in page source.

- Cleared caches (WP Rocket, Cloudflare, Flywheel)
- latest GP + Premium

Hi Sil,

The hook generate_after_content is located after the entry-content.

As you can see, on your contact page, there is a entry-content:
https://www.screencast.com/t/kRvbacYZ

But the other page is not using the GP default template, so there's no entry-content, so the hook doesn't work.
https://www.screencast.com/t/gEaxzaYJ6qJV

You can try generate_before_footer hook.

Let me know if this helps :)

Thank you so much Ying!
That was the exact issue and solution. 🥳

Also, I wrongfully assumed that if the Element is shown in the WP admin header bar it is triggered on that page.

You are welcome :)

Glad it's working now!

This archived topic is closed to new replies.