Howto add adsense ads to Elgg user blog/s

Saturday, 19th March 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 😉

Share this on:

Download PDFDownload PDF

Tags:

4 Responses to “Howto add adsense ads to Elgg user blog/s”

  1. harry says:
    Firefox 3.6.17 Firefox 3.6.17 Windows 7 Windows 7
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17

    Can you please let me know how can I show related or similar blog posts in elgg.

    View CommentView Comment
    • admin says:
      Opera 11.00 Opera 11.00 GNU/Linux x64 GNU/Linux x64
      Opera/9.80 (X11; Linux x86_64; U; en) Presto/2.7.62 Version/11.00

      Hi Harry,

      I’m not aware if at the present moment there is a publicized plugin that will allow elgg to do that.
      However I think it might be easy to port a wordpress related posts plugin to elgg.
      I guess, there should be some articles online on how a wordpress plugin can be ported to elgg.
      Still I cannot know for sure since, I haven’t done a comprehensive research online, but as far as my knowledge goes there is not.
      When I have some time I’ll lookup online and see if I can help with something. In the mean time if you find a way to do that pls post it here. Related posts in elgg blog posts sounds challenging 🙂

      Thanks for dropping by,
      Best!
      Georgi

      View CommentView Comment
  2. should I go for this PC? says:
    Google Chrome 27.0.1453.116 Google Chrome 27.0.1453.116 Windows 7 Windows 7
    Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36

    I’ve just found a decent looking Computer online, the Dell One 2330 io2330-2273BK Computer,
    and I am just looking to get some opinions on if this is really
    worth the cash!

    View CommentView Comment
  3. Errol says:
    Safari 5.1.9 Safari 5.1.9 Mac OS X 10.6.8 Mac OS X 10.6.8
    Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.59.8 (KHTML, like Gecko) Version/5.1.9 Safari/534.59.8

    Πολύ χρήσιμο το website σας! Συγχαρητήρια!

    View CommentView Comment

Leave a Reply

CommentLuv badge