Posts Tagged ‘Howto add adsense ads to Elgg user blog/s’

Howto add adsense ads to Elgg user blog/s

Saturday, March 19th, 2011

I wanted to add google adsense on my Elgg powered experimental social network mockateacher.com

There are plenty of ways described which enables a user to add a google adsense code to elgg, however none of the ones I've red online worked for me for my elgg site user blog section

One of the promising ways to add the adsense code to all sections of an elgg enpowered website is described to be achieved through Elgg Google Adverts in the spotlight plugin.
I gave this suggested method for adsense inclusion to elgg by installing and setting it up but it worked not.

There was a blog which described a procedure which gaves a possibility the adsense code to be embedded on every user dashboard's right widget right below the elgg's Edit Page

This method seems to work but wasn't exactly enabling me to place google advertisements only on the elgg's blogs and therefore was useless to me.

Thus I played a bit with the files in the mod/blog located under the elgg's install root directory and hooray I found out a way to add my adsense code to my elgg user blog section.

Here is how:

1. Edit the file mod/blog/views/default/blog/object/blog.php

In the file look for the line:

<div class="blog_post">

This is located nearbly line 51 in the file on my elgg version 1.7.7, with latest available blog plugin at this time, on prior version this might be located on different line.

After this line just place your Adsense code obtained from your Adsense Google account and you're done.
The google adsense advertisements will start appearing in the head of your elgg's users blog pages 😉