Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1078499
    socialite7
    Participant

    I have an issue with my facebook pixel. For some reason part of the code stays at the top of the header. how do i get it to go away?

    here is the code:

    // Add Facebook custom audience pixel Code
    // =============================================================================
    function add_facebook_audience_pixel_code(){
    ?>

    <!– Insert Facebook custom audience pixel Code starts here –>
    <!– Facebook Pixel Code –>
    <script>
    !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
    n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
    n.push=n;n.loaded=!0;n.version=’2.0′;n.queue=[];t=b.createElement(e);t.async=!0;
    t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
    document,’script’,’https://connect.facebook.net/en_US/fbevents.js&#8217;);

    fbq(‘init’, ‘1609658502616787’);
    fbq(‘track’, “PageView”);</script>

    <?php

    switch ( get_the_ID() ) {

    case 1723: echo “fbq(‘track’, ‘Lead’);”; break;

    case 208: echo “fbq(‘track’, ‘ViewContent’);”; break;

    }

    ?>

    </script>
    <noscript><img height=”1″ width=”1″ style=”display:none”
    src=”https://www.facebook.com/tr?id=1609658502616787&ev=PageView&noscript=1&#8243;
    /></noscript>
    <!– End Facebook Pixel Code –>

    <!– Insert Facebook custom audience pixel Code Code ends here –>

    <?php
    }
    add_action( ‘wp_head’, ‘add_facebook_audience_pixel_code’ );
    // End Facebook custom audience pixel Code
    // =================

    #1078972
    Christopher
    Moderator

    Hi there,

    Please update your code to :

    // Add Facebook custom audience pixel Code
    // =============================================================================
    function add_facebook_audience_pixel_code(){
    ?>
    
    <!– Insert Facebook custom audience pixel Code starts here –>
    <!– Facebook Pixel Code –>
    <script>
    !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
    n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
    n.push=n;n.loaded=!0;n.version='2.0′;n.queue=[];t=b.createElement(e);t.async=!0;
    t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
    document,'script','https://connect.facebook.net/en_US/fbevents.js');
    
    fbq('init', '1609658502616787');
    fbq('track', "PageView");</script>
    
    <?php
    
    switch ( get_the_ID() ) {
    
    case 1723: echo "fbq('track', 'Lead');"; break;
    
    case 208: echo "fbq('track', 'ViewContent');"; break;
    
    }
    
    ?>
    
    </script>
    <noscript><img height="1" width="1" style="display:none"
    src="https://www.facebook.com/tr?id=1609658502616787&ev=PageView&noscript=1"
    /></noscript>
    <!– End Facebook Pixel Code –>
    
    <!– Insert Facebook custom audience pixel Code Code ends here –>
    
    <?php
    }
    add_action( 'wp_head', 'add_facebook_audience_pixel_code' );
    // End Facebook custom audience pixel Code
    // =================

    Hope it helps.

  • <script> jQuery(function($){ $("#no-reply-1078499 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>