Changing ad location for ad sharing plugin

The ads are being placed in a presentable places - but not practical ones. How can I manually set where the adverts should go on a post page?

FYI: If you do view the website to see what I'm talking about ignore the ads on the index and pages - these have been put there manually. Ad Sharing is only enabled before and after posts.

Thank you,
Michael

  • aristath

    Hello again @Michael,

    The plugin add the ads using line 107 of the ad-sharing plugin:
    add_filter( 'the_content', array( &$this, 'display_ads' ), 20, 1 );

    In order to remove that you'll have to write some custom code in your theme's functions.php file. Something like the below should work:

    $adshare = new Ad_Sharing();
    remove_filter( 'the_content', array( 4adshare, 'display_ads' ), 20 );

    If that doesn't work, try something like this instead:

    function my_custom_remove_ads() {
      $adshare = new Ad_Sharing();
      remove_filter( 'the_content', array( 4adshare, 'display_ads' ), 20 );
    }
    // Please note:
    // Only 1 of the below lines will actually work
    // Test them and decide which one to keep
    add_action( 'init', 'my_custom_remove_ads' );
    add_action( 'wp', 'my_custom_remove_ads' );
    add_action( 'the_post', 'my_custom_remove_ads' );

    Please let me know if that works for you!
    Once you remove the default ads we'll be able to custom-code something that will allow you to add your ads where you want them.
    Please note that I'll need to know which one of the above actually worked in order to provide a suitable solution for adding the ads. :slight_smile:

    Cheers,
    Ari.

  • aristath

    Hello again @Michael,

    I've tried the above and it didn't remove the ads I'm afraid. I've tired both options above. Any thoughts? (I'm useless at WP programming)

    I'm afraid I'm out of ideas here... I have however notified our Second Level Support (they're the code gurus) on this one, hopefully they'll be able to help us figure this one out!

    Also, if my membership stops to WPMU does the plugin stop working too? Or is the subscription just required for updates and support?

    Your subscription is only required for updates & support.
    Your plugins will continue working even after the subscription ends. The only exception to the above rule is plugins that require access to our API, such as the Anti-Splog plugin.

    Cheers,
    Aori.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.