Created
July 12, 2015 04:56
-
-
Save kellenmace/227d79f62543abeb49b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Add Facebook Conversion Pixel with Custom Post Widget | |
Description: Add Facebook Conversion Pixel with Custom Post Widget | |
Version: 1.0 | |
Author: Kellen Mace | |
Author URI: http://kellenmace.com/ | |
License: GPLv2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ | |
function fb_pxl_for_custom_post_widget() { | |
global $post; | |
// Bail if the content of this page doesn't include a content_block shortcode | |
if ( ! has_shortcode( $post->post_content, 'content_block' ) { | |
return; | |
} | |
// If user has enabled the content_block post type, insert conversion pixel code | |
if ( isset( $fb_pxl_options[ 'content_block' ] ) && 'on' === $fb_pxl_options[ 'content_block' ] ) { | |
$fb_pxl_code = " | |
PASTE CONVERSION PIXEL CODE HERE | |
"; | |
echo $fb_pxl_code; | |
} | |
} | |
add_action( 'wp_head', 'fb_pxl_for_custom_post_widget' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment