Skip to content

Instantly share code, notes, and snippets.

@amdrew
Last active August 29, 2015 14:18
Show Gist options
  • Save amdrew/a8be1db4d11774418714 to your computer and use it in GitHub Desktop.
Save amdrew/a8be1db4d11774418714 to your computer and use it in GitHub Desktop.
OptimizePress + AffiliateWP. Shows how to load a different shortcode for different pages
function affwp_opi_add_tracking_shortcode() {
// this can be the page ID, page slug, or page title. Page title is shown below
if ( is_page( 'Your Success Page' ) ) {
echo do_shortcode( '[affiliate_conversion_script description="Your Description" amount="100"]' );
}
// another "thanks" page using a page ID
if ( is_page( 50 ) ) {
echo do_shortcode( '[affiliate_conversion_script description="A different description" amount="200"]' );
}
}
add_action( 'wp_head', 'affwp_opi_add_tracking_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment