Skip to content

Instantly share code, notes, and snippets.

@kraftbj
Last active April 11, 2017 15:17
Show Gist options
  • Save kraftbj/896fe7769339e2d2e2e960718a3a918c to your computer and use it in GitHub Desktop.
Save kraftbj/896fe7769339e2d2e2e960718a3a918c to your computer and use it in GitHub Desktop.
Only display Jetpack Ads on posts
<?php // Remove this line if copy/pasting to an existing file.
/*
Plugin Name: Only Display Jetpack Ads on Posts
Plugin URI: https://kraft.blog
Description: Only output Jetpack Ads on posts and no other post type.
Author: Kraft
Author URI: https://kraft.im/
Version: 2016.06.15
License: GPL
*/
add_action( 'wp', 'bk_limit_jetpack_ads_posts' );
function bk_limit_jetpack_ads_posts(){
if ( get_post_type() != 'post' ){
add_filter( 'wordads_inpost_disable', '__return_true' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment