Skip to:

Re: Google Adsense



I’d advise against using header.php, because your header is also shown on non-content pages such as 404’s; something which is disallowed in the adsense T’s and C’s.

I did it by writing a small plugin, which you’re welcome to. Just create a my-plugins folder within your bbpress root folder, paste the text below into the file and save it as bbpress-adsense.php, upload it to your server and an advert will appear on every topic.

From there on you have the basics for changing the advert to whatever you prefer.



Plugin Name: Simple bbPress Adsense

Plugin URI:

Description: An plugin that includes an adsense advert just above the content on the topic page.

Author: Rich Boakes

Version: 0.1

Author URI:

License: GPL


class bb_adsense {

function wide_advert() {


<div class="bbpress-adsense" style="text-align:center;">

<!-- Paste your advert below this line -->

<script type="text/javascript"><!--

google_ad_client = "pub-9050338238897291";

google_ad_width = 728;

google_ad_height = 90;

google_ad_format = "728x90_as";

google_ad_type = "text_image";

google_ad_channel = "5984252204";

google_color_border = "FFFFFF";

google_color_bg = "EEEEEE";

google_color_link = "990000";

google_color_text = "333333";

google_color_url = "999999";


<script type="text/javascript"



<!-- Paste your advert above this line -->



} // function wide_advert

} // class bb_adsense

// adds the footer so the javascript is loaded

add_action('under_title', array('bb_adsense','wide_advert'));


Skip to toolbar