[Resolved] Theme crashing using Bluehost – host says it's the theme's PHP

Home Forums Support [Resolved] Theme crashing using Bluehost – host says it's the theme's PHP

Home Forums Support Theme crashing using Bluehost – host says it's the theme's PHP

  • This topic has 7 replies, 4 voices, and was last updated 5 years ago by David.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #848484
    Evan

    Hi –

    I recently tried to set up Google Analytics by adding my GA tag to the site’s PHP footer. To do this, I had Bluehost support do it for me.

    However, when the GA tag was added, my site simultaneously crashed. Bluehost support informed me that the GeneratePress theme was corrupted, something about the PHP not being compatible with Bluehost or something like that.

    They were able to switch to another theme and get the site back online, but every time I switch back to the GeneratePress theme, my site crashes with an HTTP 500 error. When I contact Bluehost, they tell me the same thing, that the theme’s PHP files are corrupted and need to be updated.

    They’ve told me to reach out to the theme provider for help.

    Does any of this make sense? Hopefully. Currently, each time I turn on the GeneratePress theme, the site crashes with a 500 error, and Bluehost tells me only the theme provider can address the PHP issue.

    Any help greatly appreciated. The theme has worked great for the past six months or more, and just started crashing the past few days. Perhaps related, I know Bluehost upgraded their PHP on March 13th.

    – Evan

    #848591
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    It sounds like the code they added to the theme had errors in it. Is it possible to remove that code from the footer?

    If not, you’ll want to delete the theme completely and install it again from scratch.

    Then you can add the code using a Hook Element instead: https://docs.generatepress.com/article/hooks-element-overview/

    If you’d like to share the code here, we can check it for errors.

    #849790
    Evan

    Awesome, I was able to get the site back online by deleting/redownloading, thanks!

    Regarding the code, I’ve pasted it below. When using a hook, would I paste the entire GA code below, or just a portion?

    Thanks as always!

    – Evan

    <!– Global site tag (gtag.js) – Google Analytics –>
    <script async src=”https://www.googletagmanager.com/gtag/js?id=UA-100766377-2″></script&gt;
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag(‘js’, new Date());

    gtag(‘config’, ‘UA-100766377-2’);
    </script>

    #849802
    Leo
    Staff
    Customer Support

    The entire block of code is needed 🙂

    #850950
    Evan

    Awesome, thanks!

    So, I set up the hook like this screenshot here. I’ve also set the display rules to “entire site” for the location.

    However, it doesn’t look like Google Analytics is picking anything up. Am I perhaps using the hook incorrectly?

    – Evan

    #851088
    David
    Staff
    Customer Support

    Hi there

    if you’re using Google Tag Manager then they provide a second script that has to be added right the opening body tag. This needs to go in a before_header hook.

    #853861
    Evan

    Got it to work, thanks!

    #854095
    David
    Staff
    Customer Support

    Glad to hear that

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