Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I need to add a tracking pixel for a Facebook ad to my Wordpress site. It should only be active for one blog post, not for every page on the site.

How can I get the script into the HEAD section for the specific post only?

share|improve this question
2  
what have you tried? –  Mark Kaplun Feb 12 '13 at 17:15

1 Answer 1

You can use the wordpress Conditional Tags

You can add something like this to your functions.php file:

is_single( 'your-post-slug' )
    add_action( 'wp_head', 'your_function_with_pixel' )

There are a number of different conditional tags you can use. And your-post-slug can be substituted with the post id as well.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.