A
A
avdoshka2019-08-05 18:55:20
JavaScript
avdoshka, 2019-08-05 18:55:20

Resolve WordPress plugin and menu conflict with Facebook Pixel fragment?

Having trouble pasting my Facebook pixel code into one article on my Word Press site. I ONLY want the Facebook pixel to appear in one article. I was trying to use a Word Press plugin called "Header and Footer Scripts" as detailed in this post here:
https://makewpsimple.com/add-code-site-header/
However, whenever I add my Facebook pixel snippet through this plugin, my global menu bar on the Word Press site disappears. I've already done some basic troubleshooting, seeing if a completely harmless test snippet as shown in the attached screenshot (I don't think due to the extra work I'll be able to post the javascript here ;) is causing the same problem with the global menu which I am using. I found that this test snippet doesn't interfere with our global menu. So the issue seems to be with an actual snippet from Facebook that is causing a conflict with our menu plugin. So this project is pretty simple: How do I embed my Facebook pixel snippet in just one article on my site?5d485157012fb622325321.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pychev Anatoly, 2019-08-05
@pton

You can put the pixel code in a regular js file and include it like a regular js. And use conditional logic to connect only for the desired page

P
Pavel Chesnokov, 2019-08-15
@cesnokov

If I understand your terminology correctly, then the "global menu bar" is the WordPress AdminBar? If yes, then it usually starts the latest and any incorrect (with errors) Javascript running before it just stops everything and prevents the AdminBar from loading. Look for a bug in the code of a pixel if you claim that everything breaks when you add it.
The Facebook pixel <head></head>is optional, but recommended. So, in your case, you can insert the code anywhere on the page, but not through the visual editor, but in the page code:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question