Ad sharing on custom post type

The ads do not appear on custom post types (such as listings). That is, the ads are working good for regular posts and pages, but not for custom post types.

Is there any way to enable them on custom post types as well?

    Vaughan

    Hi @meetul,

    The ad sharing plugin doesn't support custom post types. Though let me just ask the developer to see if this is possible with some custom code.

    It might be possible by editing ad-sharing.php

    Find the following.

    if( 'page' == $post->post_type ) {
    			if ( get_site_option('advertising_location_before_page_content') == '1' ) {
    				$page_ads = $ad_sharing_page_ads->get_count();
    				if ( $page_ads < $advertising_ads_per_page ) {
    					$content = $this->get_ad_code('before') . $content;
    					$ad_sharing_page_ads->increase();
    				}
    			}
    			if ( get_site_option('advertising_location_after_page_content') == '1' ) {
    				$page_ads = $ad_sharing_page_ads->get_count();
    				if ( $page_ads < $advertising_ads_per_page ) {
    					$content = $content . $this->get_ad_code('after');
    					$ad_sharing_page_ads->increase();
    				}
    			}
    		} elseif( 'post' == $post->post_type ) {
    			if ( get_site_option('advertising_location_before_post_content') == '1' ) {
    				$page_ads = $ad_sharing_page_ads->get_count();
    				if ( $page_ads < $advertising_ads_per_page ) {
    					$content = $this->get_ad_code('before') . $content;
    					$ad_sharing_page_ads->increase();
    				}
    			}
    			if ( get_site_option('advertising_location_after_post_content') == '1' ) {
    				$page_ads = $ad_sharing_page_ads->get_count();
    				if ( $page_ads < $advertising_ads_per_page ) {
    					$content = $content . $this->get_ad_code('after');
    					$ad_sharing_page_ads->increase();
    				}
    			}
    		}

    Then simply add a new else condition to the end for listings, so it looks like.

    if( 'page' == $post->post_type ) {
    			if ( get_site_option('advertising_location_before_page_content') == '1' ) {
    				$page_ads = $ad_sharing_page_ads->get_count();
    				if ( $page_ads < $advertising_ads_per_page ) {
    					$content = $this->get_ad_code('before') . $content;
    					$ad_sharing_page_ads->increase();
    				}
    			}
    			if ( get_site_option('advertising_location_after_page_content') == '1' ) {
    				$page_ads = $ad_sharing_page_ads->get_count();
    				if ( $page_ads < $advertising_ads_per_page ) {
    					$content = $content . $this->get_ad_code('after');
    					$ad_sharing_page_ads->increase();
    				}
    			}
    		} elseif( 'post' == $post->post_type ) {
    			if ( get_site_option('advertising_location_before_post_content') == '1' ) {
    				$page_ads = $ad_sharing_page_ads->get_count();
    				if ( $page_ads < $advertising_ads_per_page ) {
    					$content = $this->get_ad_code('before') . $content;
    					$ad_sharing_page_ads->increase();
    				}
    			}
    			if ( get_site_option('advertising_location_after_post_content') == '1' ) {
    				$page_ads = $ad_sharing_page_ads->get_count();
    				if ( $page_ads < $advertising_ads_per_page ) {
    					$content = $content . $this->get_ad_code('after');
    					$ad_sharing_page_ads->increase();
    				}
    			}
    		} elseif( 'listings' == $post->post_type ) {
    			if ( get_site_option('advertising_location_before_post_content') == '1' ) {
    				$page_ads = $ad_sharing_page_ads->get_count();
    				if ( $page_ads < $advertising_ads_per_page ) {
    					$content = $this->get_ad_code('before') . $content;
    					$ad_sharing_page_ads->increase();
    				}
    			}
    			if ( get_site_option('advertising_location_after_post_content') == '1' ) {
    				$page_ads = $ad_sharing_page_ads->get_count();
    				if ( $page_ads < $advertising_ads_per_page ) {
    					$content = $content . $this->get_ad_code('after');
    					$ad_sharing_page_ads->increase();
    				}
    			}
    		}

    I haven't tested though.

    Hope this helps