The MU forums have moved to

Adding Google AdSense to All Blogs (9 posts)

  1. calumneilson
    Posted 16 years ago #


    I have done a quick search but none of the posted methods seem to work.

    I am using the latest version of MUWP with subdomains and have installed about 80 themes from a pack.

    I was wondering how I would get a Google AdSense ad under the first post on every blog that is hosted.

    I tried MightyAdSense but it didn't seem to work, I don't know why.

    I know I could edit all the theme files, but that would take hours since I have 80, and I add more themes daily.

    Thanks for any help.

  2. theapparatus
    Posted 16 years ago #

    By the way, you are testing your themes I hope to make sure they work as well as looking for security issues, right? ;)

    Gotta admit that the only method I know of is hard coding as I'm not aware of any hook in there to use.

  3. hhuskies
    Posted 16 years ago #

    Another thing to consider:

    I just recently took Adsense off of my WordPress MU system, as it wouldn't be worth it to get banned just because someone on the system posted something not under Google's TOS. Just a thought.

    Cheerful Trails,


  4. SteveAtty
    Posted 16 years ago #

    Well you could always wrap the Google Adsense TOS into your AUP -which for a lot of blogs would seem to be pretty sensible.

  5. Konstan
    Posted 16 years ago #

    I hardcoded it to every theme I have. Pain in the ass, but it works.

  6. andrea_r
    Posted 16 years ago #

    Yep, you pretty much have to hardcode them in the theme.

  7. Humor-guy
    Posted 16 years ago #

    Easiest way is to just include it in the themes.

  8. gighen
    Posted 16 years ago #

    you can try just using $sed and put it just after the <body> tag o just before </body> [every theme has them]

  9. xknown
    Posted 16 years ago #

    calumneilson, a WPMU plugin can do the trick although I don't know what have you tried:

    function global_adsense($the_content) {
    	$the_content .= 'Your adsense script';
    	remove_filter('the_content', 'global_adsense'); // only for the first post
    	return $the_content;
    add_filter('the_content', 'global_adsense');

About this Topic

  • Started 16 years ago by calumneilson
  • Latest reply from xknown