Site logo

Archived topic

Hooks Don't Work on New Elements Module

6 replies · Started by Zad on August 14, 2018

Viewing posts 1–7 of 7

Hi, I recently migrated to the new Elements module on GPP 1.7 and migrated all my hooks and deactivated "Hooks" and "Page Header". For some reason, my hooks no longer seem to work.

Here are the hooks I use.

For wp_head

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-116104766-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-116104766-1');
</script>

Also wp_head

<link rel="stylesheet" href="https://use.typekit.net/lnt3pze.css">

And wp_footer

<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.js"></script>
<script>
window.addEventListener("load", function(){
window.cookieconsent.initialise({
  "palette": {
    "popup": {
      "background": "#666666",
      "text": "#efefef"
    },
    "button": {
      "background": "#d46c5b",
      "text": "#efefef"
    }
  },
  "theme": "classic",
  "position": "bottom-right",
  "content": {
    "href": "https://www.lesslikely.com/privacy-policy/"
  }
})});
</script>

Hi there,

Have you cleared your caching plugin?

If so and it's not working, can you deactivate it so I can view your source?

Sure, just deactivated my caching plugin. Yes, cache was also cleared

Oh okay, seems to work now! I think the problem was that I was using several browsers to check the cookie content popup, Mozilla and Safari, but they both weren't accepting cookies. It is a bit odd though because I've never encountered this issue before on those browsers. Seems to work fine.

Is there a particular priority I should put for each of these hooks? Would there be any problem with giving them all priority 1 etc?

Priority shouldn't matter for these hooks.

Sometimes if you want an element to appear above or below another, you would use the priority.

Glad it's all working now :)

This archived topic is closed to new replies.